* Commit to more than one branch at once?
@ 2006-10-06 18:18 Stefan Richter
2006-10-06 18:37 ` Linus Torvalds
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Stefan Richter @ 2006-10-06 18:18 UTC (permalink / raw)
To: git
Hi all,
if I git-cherry-pick a commit from branch A into branch B, this is shown
as a difference in "git-log B..A".
Is it possible to commit a change to two or more branches but preserve
the identity of the change? IOW, is there an alternative to
git-cherry-pick that does not have above mentioned side effect?
--
Stefan Richter
-=====-=-==- =-=- --==-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Commit to more than one branch at once?
2006-10-06 18:18 Commit to more than one branch at once? Stefan Richter
@ 2006-10-06 18:37 ` Linus Torvalds
[not found] ` <20061006143804.abb6c321.seanlkml@sympatico.ca>
2006-10-06 18:52 ` Petr Baudis
2 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2006-10-06 18:37 UTC (permalink / raw)
To: Stefan Richter; +Cc: git
On Fri, 6 Oct 2006, Stefan Richter wrote:
>
> if I git-cherry-pick a commit from branch A into branch B, this is shown
> as a difference in "git-log B..A".
>
> Is it possible to commit a change to two or more branches but preserve
> the identity of the change? IOW, is there an alternative to
> git-cherry-pick that does not have above mentioned side effect?
If you _merge_ the change into both branches, it will be the identical
commit in both.
So for example, one thing people can do is to have a separate "fixes"
branch that is used for generic bugfixes and, which is merged into all
other relevant branches.
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Commit to more than one branch at once?
[not found] ` <20061006143804.abb6c321.seanlkml@sympatico.ca>
@ 2006-10-06 18:38 ` Sean
2006-10-06 19:23 ` Stefan Richter
0 siblings, 1 reply; 5+ messages in thread
From: Sean @ 2006-10-06 18:38 UTC (permalink / raw)
To: Stefan Richter; +Cc: git
On Fri, 06 Oct 2006 20:18:42 +0200
Stefan Richter <stefanr@s5r6.in-berlin.de> wrote:
> if I git-cherry-pick a commit from branch A into branch B, this is shown
> as a difference in "git-log B..A".
>
> Is it possible to commit a change to two or more branches but preserve
> the identity of the change? IOW, is there an alternative to
> git-cherry-pick that does not have above mentioned side effect?
Short answer:
No.
Slightly longer answer:
Only merging the branches will make the commit show up in branch B with
the same SHA1 number (or identity) that it had in branch A. This is a
fundamental part of Git. The sha1 of each commit is based in part on
the sha1 of its parent. Thus it's impossible[1] to copy a commit to
another branch (ie. reparent it) without changing its identity.
Sean
[1] Okay, more or less impossible.. don't ask me do the math.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Commit to more than one branch at once?
2006-10-06 18:18 Commit to more than one branch at once? Stefan Richter
2006-10-06 18:37 ` Linus Torvalds
[not found] ` <20061006143804.abb6c321.seanlkml@sympatico.ca>
@ 2006-10-06 18:52 ` Petr Baudis
2 siblings, 0 replies; 5+ messages in thread
From: Petr Baudis @ 2006-10-06 18:52 UTC (permalink / raw)
To: Stefan Richter; +Cc: git
Dear diary, on Fri, Oct 06, 2006 at 08:18:42PM CEST, I got a letter
where Stefan Richter <stefanr@s5r6.in-berlin.de> said that...
> if I git-cherry-pick a commit from branch A into branch B, this is shown
> as a difference in "git-log B..A".
>
> Is it possible to commit a change to two or more branches but preserve
> the identity of the change? IOW, is there an alternative to
> git-cherry-pick that does not have above mentioned side effect?
Philosophical answer:
This is a point where it shows that Git is snapshot-based, not
changeset-based version control system. So you are not committing a
change, you are committing a snapshot taken after the change. So only
snapshots have identity and if the snapshots differ, they obviously have
different identity. Thus your commit has to have different identity.
Furthermore the commit ties the snapshot with some history (and only
this is the first moment where the concept of the 'change' emerges), and
if you have different history, identity of your commit cannot be
the same either.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Commit to more than one branch at once?
2006-10-06 18:38 ` Sean
@ 2006-10-06 19:23 ` Stefan Richter
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Richter @ 2006-10-06 19:23 UTC (permalink / raw)
To: Sean; +Cc: git
Sean wrote:
> Only merging the branches will make the commit show up in branch B with
> the same SHA1 number (or identity) that it had in branch A. This is a
> fundamental part of Git. The sha1 of each commit is based in part on
> the sha1 of its parent. Thus it's impossible[1] to copy a commit to
> another branch (ie. reparent it) without changing its identity.
>
> Sean
>
> [1] Okay, more or less impossible.. don't ask me do the math.
Ah, I didn't see the wood for the trees. And this dependence of a
commit's identity on the history is also a (or the) reason why mergers
are necessarily spliced in as commits with unique identity too...
--
Stefan Richter
-=====-=-==- =-=- --==-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-10-06 19:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-06 18:18 Commit to more than one branch at once? Stefan Richter
2006-10-06 18:37 ` Linus Torvalds
[not found] ` <20061006143804.abb6c321.seanlkml@sympatico.ca>
2006-10-06 18:38 ` Sean
2006-10-06 19:23 ` Stefan Richter
2006-10-06 18:52 ` Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox