Ok, this is do-able, let's start with changing our un-push-ed commit message :
$ git commit --amend
The line above will lead you to an editor where you can change your message on the last commit to what may satisfy you. Now, let's move on, what should we do if -we already commit the changes into the remote repository when we realized that the message need to be changed- ?
No worries! unlike our lives, we can re-write history in Git, here's what you need to do :
$ git rebase -i HEAD~1
The line above means that we want to run rebase interactively for the last commit, HEAD~2 would mean the one commit before last, and so on. This will lead you to an editor, saying something like this :
pick 9b504bf f.txt file added # Rebase 78d81b4..9b504bf onto 78d81b4 #
You would need to change the word 'pick' with 'reword', do save & exit. Next, you will face another editor where you can edit your previous commit message. Another save & exit, and then push force it. Oh my Git, it's fun! ^^
No comments:
Post a Comment