git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Modify/edit old commit messages
@ 2007-02-01 11:49 Rodolfo Giometti
  2007-02-01 12:28 ` Johannes Schindelin
  2007-02-01 23:24 ` Jakub Narebski
  0 siblings, 2 replies; 5+ messages in thread
From: Rodolfo Giometti @ 2007-02-01 11:49 UTC (permalink / raw)
  To: git

Hello,

I'm puzzled... how can I modify or edit old commit messages? :)

Thanks in advance,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

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

* Re: Modify/edit old commit messages
  2007-02-01 11:49 Modify/edit old commit messages Rodolfo Giometti
@ 2007-02-01 12:28 ` Johannes Schindelin
  2007-02-01 16:41   ` Linus Torvalds
  2007-02-01 17:17   ` Johannes Schindelin
  2007-02-01 23:24 ` Jakub Narebski
  1 sibling, 2 replies; 5+ messages in thread
From: Johannes Schindelin @ 2007-02-01 12:28 UTC (permalink / raw)
  To: Rodolfo Giometti; +Cc: git

Hi,

On Thu, 1 Feb 2007, Rodolfo Giometti wrote:

> I'm puzzled... how can I modify or edit old commit messages? :)

Short answer: you can't.

Slightly longer answer: since the object name is calculated from data 
including the commit message, there is no way you can change it.

However, you can start from a certain commit in history, and _recommit_ a 
commit. There, you can edit the message and rebase the other commits on 
top of it. NOTE: the resulting commit is _not_ easily mergeable for people 
who track your branch.

Hth,
Dscho

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

* Re: Modify/edit old commit messages
  2007-02-01 12:28 ` Johannes Schindelin
@ 2007-02-01 16:41   ` Linus Torvalds
  2007-02-01 17:17   ` Johannes Schindelin
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2007-02-01 16:41 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Rodolfo Giometti, git



On Thu, 1 Feb 2007, Johannes Schindelin wrote:
> 
> On Thu, 1 Feb 2007, Rodolfo Giometti wrote:
> > 
> > I'm puzzled... how can I modify or edit old commit messages? :)
> 
> Short answer: you can't.

Side note, just out of historical interest: in BK you could.

And if you're used to it (like I was) it was really quite practical. I 
would apply a patch-bomb from Andrew, notice something was wrong, and just 
edit it before pushing it out.

I could have done the same with git. It would have been easy enough to 
make just the commit message not be part of the name, and still guarantee 
that the history was untouched, and allow the "fix up comments later" 
thing.

But I didn't.

Part of it is purely "internal consistency". Git is simply a _cleaner_ 
system thanks to everything being SHA1-protected, and all objects being 
treated the same, regardless of object type. Yeah, there are four 
different kinds of objects, and they are all really different, and they 
can't be used in the same way, but at the same time, even if their 
encoding might be different on disk, *conceptually* they all work exactly 
the same.

But internal consistency isn't really an excuse for being inflexible, and 
clearly it would be very flexible if we could just fix up mistakes after 
they happen. So that's not a really strong argument.

The *real* reason git doesn't allow you to change the commit message ends 
up being very simple: that way, you can trust the messages. If you allowed 
people to change them afterwards, the messages are inherently not very 
trustworthy.

In BK, for example, if you edited the commit message after already pushing 
it out, it would *work*, but the stuff you pushed out would obviously not 
be changed, so different repositories would literally have different 
commit messages. I did it anyway a few times when some really irritating 
typo just made me say "I can't stand reading that typo over and over 
again, I'll fix it in my tree and screw everybody else".

But it's also very important because nobody *else* can mess with your 
history without it being obvious to everybody who has ever seen the 
pristine one, and nobody can change what you said later. Yeah, there's a 
few embarrassing typo's in the kernel history. We'll never be able to live 
down the fact that spelling and grammar is the dificultest for us. And we 
have some bugs where people have corrupt email addresses etc.

And I'll take guaranteed history over typos any day. 

			Linus

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

* Re: Modify/edit old commit messages
  2007-02-01 12:28 ` Johannes Schindelin
  2007-02-01 16:41   ` Linus Torvalds
@ 2007-02-01 17:17   ` Johannes Schindelin
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2007-02-01 17:17 UTC (permalink / raw)
  To: Rodolfo Giometti; +Cc: git

Hi,

On Thu, 1 Feb 2007, Johannes Schindelin wrote:

> On Thu, 1 Feb 2007, Rodolfo Giometti wrote:
> 
> > I'm puzzled... how can I modify or edit old commit messages? :)
> 
> Short answer: you can't.

Amendment:

You can easily, but only the latest commit, with "git commit --amend". Be 
warned though, the same as with rebase applies here: if you pushed this 
commit somewhere else, or if users fetched that branch from you (including 
the not-yet-edited commit), they _will_ have problems fetching and/or 
merging.

Ciao,
Dscho

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

* Re: Modify/edit old commit messages
  2007-02-01 11:49 Modify/edit old commit messages Rodolfo Giometti
  2007-02-01 12:28 ` Johannes Schindelin
@ 2007-02-01 23:24 ` Jakub Narebski
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2007-02-01 23:24 UTC (permalink / raw)
  To: git

[Cc: git@vger.kernel.org]

Rodolfo Giometti wrote:

> Hello,
> 
> I'm puzzled... how can I modify or edit old commit messages? :)

http://git.or.cz/gitwiki/GitTips

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

end of thread, other threads:[~2007-02-01 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-01 11:49 Modify/edit old commit messages Rodolfo Giometti
2007-02-01 12:28 ` Johannes Schindelin
2007-02-01 16:41   ` Linus Torvalds
2007-02-01 17:17   ` Johannes Schindelin
2007-02-01 23:24 ` 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).