how to edit commit message in history
I made some typos in commit messages, how to edit them without affecting everything else?
Thanks in advance.
Signature · 6 lines
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩311 無名氏 雜詩
盡寒食雨草萋萋 著麥苗風柳映堤 等是有家歸未得 杜鵑休向耳邊啼You can't, that would default the whole point of git's sha1 hashes!
If you change a commit, you will change the sha1 hash of that commit, and every subsequent commit. There is no way around it.
Quoting bill lam <[email protected]>:
Quoted 17 lines
I made some typos in commit messages, how to edit them without affecting everything else?
Thanks in advance.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 唐詩311 無名氏 雜詩
盡寒食雨草萋萋 著麥苗風柳映堤 等是有家歸未得 杜鵑休向耳邊啼
--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · bill lam
I made some typos in commit messages, how to edit them without affecting everything else?
Thanks in advance.
say, it's commit HEAD~2 to be revised.
git rebase -i HEAD~3
In your editor, you all see something like this:
pick db79377 2nd
pick fa9ced8 3rd
pick b842e49 4nd
# Rebase 1423d77..b842e49 onto 1423d77
#
# Commands:
# p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. #
Now change "pick" to "edit" with your typo commit, save it and exit. You will see something like this:
$ git-rebase -i HEAD~3 Stopped at db79377... 2nd You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
Just follow the instructions.
Signature · 2 lines
Thanks, Jike
Quoted 2 lines · bill lam
I made some typos in commit messages, how to edit them without affecting everything else?
If it is last commit that you want to edit, and if you didn't publish this commit to soem public repository, you can simply use
$ git commit --amend
If the commit is deeper in history, use "git rebase --interactive". If you published commit, you are out of luck.
See http://git.or.cz/gitwiki/GitTips
Signature · 3 lines
Jakub Narebski Poland ShadeHawk on #git