git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to edit commit message in history
@ 2009-01-16  3:57 bill lam
  2009-01-16  4:09 ` Jike Song
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bill lam @ 2009-01-16  3:57 UTC (permalink / raw)
  To: git

I made some typos in commit messages, how to edit them without
affecting everything else?

Thanks in advance.

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩311 無名氏  雜詩
    盡寒食雨草萋萋  著麥苗風柳映堤  等是有家歸未得  杜鵑休向耳邊啼

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to edit commit message in history
  2009-01-16  3:57 how to edit commit message in history bill lam
@ 2009-01-16  4:09 ` Jike Song
  2009-01-16  4:31 ` thestar
  2009-01-16 11:18 ` Jakub Narebski
  2 siblings, 0 replies; 4+ messages in thread
From: Jike Song @ 2009-01-16  4:09 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to edit commit message in history
  2009-01-16  3:57 how to edit commit message in history bill lam
  2009-01-16  4:09 ` Jike Song
@ 2009-01-16  4:31 ` thestar
  2009-01-16 11:18 ` Jakub Narebski
  2 siblings, 0 replies; 4+ messages in thread
From: thestar @ 2009-01-16  4:31 UTC (permalink / raw)
  To: bill lam; +Cc: git

You can't, that would default the whole point of git's sha1 hashes!

If you change a commit, you will change the sha1 hash of that commit,  
and every subsequent commit. There is no way around it.

Quoting bill lam <cbill.lam@gmail.com>:

> I made some typos in commit messages, how to edit them without
> affecting everything else?
>
> Thanks in advance.
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> 唐詩311 無名氏  雜詩
>     盡寒食雨草萋萋  著麥苗風柳映堤  等是有家歸未得  杜鵑休向耳邊啼
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to edit commit message in history
  2009-01-16  3:57 how to edit commit message in history bill lam
  2009-01-16  4:09 ` Jike Song
  2009-01-16  4:31 ` thestar
@ 2009-01-16 11:18 ` Jakub Narebski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Narebski @ 2009-01-16 11:18 UTC (permalink / raw)
  To: bill lam; +Cc: git

bill lam <cbill.lam@gmail.com> writes:

> I made some typos in commit messages, how to edit them without
> affecting everything else?

If it is last commit that you want to edit, and if you didn't publish
this commit to soem public repository, you can simply use

  $ git commit --amend

If the commit is deeper in history, use "git rebase --interactive".
If you published commit, you are out of luck.

See http://git.or.cz/gitwiki/GitTips
-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-16 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-16  3:57 how to edit commit message in history bill lam
2009-01-16  4:09 ` Jike Song
2009-01-16  4:31 ` thestar
2009-01-16 11:18 ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).