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

Re: Edit log message after commit

From
Yasushi SHOJI <yashi@atmark-techno.com>
Date
Sep 29, 2005, 16:05 UTC
Message-ID
<87br2bq2ot.wl@mail2.atmark-techno.com>
In-Reply-To
<dhg5vl$9ac$1@sea.gmane.org>

At Thu, 29 Sep 2005 15:45:49 +0800, Kevin Leung wrote:

Show 5 quoted lines
> 
> But as Tony has pointed out. I would have needed to redo all the
> subsequent commits if I was to change non-HEAD commit message. What
> is the proper way of doing that? Is it the same as
> Documentation/howto/revert-branch-rebase.txt ?

as pointed out by others, if the tree is already public, do revert. otherwise, use git-cherry-pick and git-rebase might help. but it might not be a good idea. (don't know)

to illustrate this, create the following tree
c
|
b
|
a
|
initial
    git-init-db
    echo hello > hello.c
    git-update-index --add hello.c
    git-commit -v -m 'initial'
    echo a >> hello.c
    git-commit -a -m 'add a'
    echo b >> hello.c
    git-commit -a -m 'add b'
    echo c >> hello.c
    git-commit -a -m 'add c'
say, you want to edit the commit message for 'add a'.
first, create new branch at where you wanna change the message
    git checkout -b temp HEAD^^^   # hmm... HEAD^3 doesn't work
cherry pick the 'add a' commit but don't commit yet
    git-cherry-pick -n master^^
commit the change with reediting the original commit log
    git commit --reedit master^^
rebase the _master_ to temp
    git-checkout master
    git-rebase temp

I'm pretty sure that there is better way to do it and these should be easy to be scripted.

my two cents,
--
          yashi
Previous: Kevin LeungNext: Junio C Hamano
Message 6 of 9 in “Edit log message after commit”
  1. Kevin LeungSep 29, 2005
  2. Junio C HamanoSep 29, 2005
  3. Tony LuckSep 29, 2005
  4. Brian GerstSep 29, 2005
  5. Kevin LeungSep 29, 2005
  6. Yasushi SHOJISep 29, 2005
  7. Junio C HamanoSep 30, 2005
  8. Catalin MarinasSep 29, 2005
  9. Kevin LeungSep 30, 2005

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.