git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to edit commit message in history

From
JSJike 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
Previous: bill lamNext: thestar@fussycoder.id.au
Message 2 of 4 in “how to edit commit message in history”
  1. bill lamJan 16, 2009
  2. Jike SongJan 16, 2009
  3. thestar@fussycoder.id.auJan 16, 2009
  4. Jakub NarebskiJan 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.