Both of these methods will create a new commit with the updated message and this new commit will replace the older one.Ī thing to note here is that Git will block us from pushing this updated commit history to the remote repository because we have effectively altered the history of our project and it will not match the existing history on the remote repository. If this commit is the most recent one, then we can use the -amend option with the Git Commit command to update the message.įor older commits, we use the Git Rebase command in the interactive mode. We frequently make commits in our repository but sometimes, we may want to change the message of a commit. Just replace the word pick by reword for all the commits whose message you want to change and Git will open a text editor for each commit so that you can change the message. The interactive mode of rebasing can also be used to change multiple commit messages at once. Also, the hash is different, indicating that a new commit was created and replaced our existing one.
0 Comments
Leave a Reply. |