All of lore.kernel.org
 help / color / mirror / Atom feed
* Using git-replace to edit a commit message?
@ 2011-05-22 22:11 Joe Smith
  2011-05-23  2:11 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Smith @ 2011-05-22 22:11 UTC (permalink / raw)
  To: git


A somewhat common question with Git is how to change a commit message of an
already created commit. 

When this question comes up, the most common case is an unpublished commit,
which can safely be corrected by re-writing history.

Occasionally the question is about a published commit. Sometimes even for
published repositories rewriting history is acceptable, but often it is not.
In that case the usual answer is either: there is nothing you can do without
rewriting history, or add a note to the commit.

Is that really true?

It occurs to me that the following procedure should work rather well for
this, as long as it is not a frequent occurrence.

Create a new commit object with the correct text (or correct author,
or correct committer), ensuring that the the listed tree and parent
SHA-1 hashes are correct (i.e. are the same those hashes in the commit
being "edited").

Then simply use git-replace to have all references to the "unedited"
commit instead use this new commit.

Is there some reason that will not work? If it would work, is there
some reason nobody ever seems to suggest it?

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

* Re: Using git-replace to edit a commit message?
  2011-05-22 22:11 Using git-replace to edit a commit message? Joe Smith
@ 2011-05-23  2:11 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2011-05-23  2:11 UTC (permalink / raw)
  To: Joe Smith; +Cc: git

Joe Smith <unknown_kev_cat@hotmail.com> writes:

> Is there some reason that will not work? If it would work, is there
> some reason nobody ever seems to suggest it?

It would; I think the real reason is because it is not worth the trouble
for asking everybody to trust your replace refs and install them in their
repository and pay the runtime cost. Most people just move on once their
mistakes are public.

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

end of thread, other threads:[~2011-05-23  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-22 22:11 Using git-replace to edit a commit message? Joe Smith
2011-05-23  2:11 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.