{"thread":{"id":"17199","subject":"how to edit commit message in history","startedAt":"2009-01-16T03:57:14Z","lastAt":"2009-01-16T11:18:37Z","messageCount":4,"participants":["bill lam","Jike Song","thestar@fussycoder.id.au","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"100696","messageId":"20090116035714.GA6984@b2j","threadId":"17199","inReplyTo":null,"subject":"how to edit commit message in history","fromName":"bill lam","fromEmail":"cbill.lam@gmail.com","sentAt":"2009-01-16T03:57:14Z","receivedAt":"2009-01-16T03:57:14Z","isPatch":false,"sender":{"key":"cbill.lam@gmail.com","avatar":null},"body":"I made some typos in commit messages, how to edit them without\naffecting everything else?\n\nThanks in advance.\n\n-- \nregards,\n====================================================\nGPG key 1024D/4434BAB3 2008-08-24\ngpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n唐詩311 無名氏  雜詩\n    盡寒食雨草萋萋  著麥苗風柳映堤  等是有家歸未得  杜鵑休向耳邊啼\n"},{"id":"100697","messageId":"df9815e70901152009i3bd717d0t6c20c41e9be19552@mail.gmail.com","threadId":"17199","inReplyTo":"20090116035714.GA6984@b2j","subject":"Re: how to edit commit message in history","fromName":"Jike Song","fromEmail":"albcamus@gmail.com","sentAt":"2009-01-16T04:09:27Z","receivedAt":"2009-01-16T04:09:27Z","isPatch":false,"sender":{"key":"albcamus@gmail.com","avatar":null},"body":"On Fri, Jan 16, 2009 at 11:57 AM, bill lam <cbill.lam@gmail.com> wrote:\n> I made some typos in commit messages, how to edit them without\n> affecting everything else?\n>\n> Thanks in advance.\n\nsay, it's commit HEAD~2 to be revised.\n\n    git rebase -i HEAD~3\n\nIn your editor, you all see something like this:\n\npick db79377 2nd\npick fa9ced8 3rd\npick b842e49 4nd\n\n# Rebase 1423d77..b842e49 onto 1423d77\n#\n# Commands:\n#  p, pick = use commit\n#  e, edit = use commit, but stop for amending\n#  s, squash = use commit, but meld into previous commit\n#\n# If you remove a line here THAT COMMIT WILL BE LOST.\n# However, if you remove everything, the rebase will be aborted.\n#\n\n\n\nNow change \"pick\" to \"edit\" with your typo commit, save it and exit.\nYou will see something like this:\n\n$ git-rebase -i HEAD~3\nStopped at db79377... 2nd\nYou can amend the commit now, with\n\n        git commit --amend\n\nOnce you are satisfied with your changes, run\n\n        git rebase --continue\n\n\nJust follow the instructions.\n\n-- \nThanks,\nJike\n"},{"id":"100699","messageId":"20090116153156.tfzar9idq8gwk0wg@webmail.fussycoder.id.au","threadId":"17199","inReplyTo":"20090116035714.GA6984@b2j","subject":"Re: how to edit commit message in history","fromName":"","fromEmail":"thestar@fussycoder.id.au","sentAt":"2009-01-16T04:31:56Z","receivedAt":"2009-01-16T04:31:56Z","isPatch":false,"sender":{"key":"thestar@fussycoder.id.au","avatar":null},"body":"You can't, that would default the whole point of git's sha1 hashes!\n\nIf you change a commit, you will change the sha1 hash of that commit,  \nand every subsequent commit. There is no way around it.\n\nQuoting bill lam <cbill.lam@gmail.com>:\n\n> I made some typos in commit messages, how to edit them without\n> affecting everything else?\n>\n> Thanks in advance.\n>\n> --\n> regards,\n> ====================================================\n> GPG key 1024D/4434BAB3 2008-08-24\n> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n> 唐詩311 無名氏  雜詩\n>     盡寒食雨草萋萋  著麥苗風柳映堤  等是有家歸未得  杜鵑休向耳邊啼\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"100716","messageId":"m34ozzzegn.fsf@localhost.localdomain","threadId":"17199","inReplyTo":"20090116035714.GA6984@b2j","subject":"Re: how to edit commit message in history","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-16T11:18:37Z","receivedAt":"2009-01-16T11:18:37Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"bill lam <cbill.lam@gmail.com> writes:\n\n> I made some typos in commit messages, how to edit them without\n> affecting everything else?\n\nIf it is last commit that you want to edit, and if you didn't publish\nthis commit to soem public repository, you can simply use\n\n  $ git commit --amend\n\nIf the commit is deeper in history, use \"git rebase --interactive\".\nIf you published commit, you are out of luck.\n\nSee http://git.or.cz/gitwiki/GitTips\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}