Re: how to edit commit message in history
On Fri, Jan 16, 2009 at 11:57 AM, bill lam <cbill.lam@gmail.com> wrote:
> 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.
--
Thanks,
Jike