Re: how to edit commit message in history
- From
- Jike Song <albcamus@gmail.com>
- Date
- Jan 16, 2009, 04:09 UTC
- Message-ID
- <df9815e70901152009i3bd717d0t6c20c41e9be19552@mail.gmail.com>
- In-Reply-To
- <20090116035714.GA6984@b2j>
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