* Can Git push only first parent history commits?
@ 2008-12-08 2:52 Li Frank
2008-12-08 3:00 ` Junio C Hamano
2008-12-08 4:03 ` Boyd Stephen Smith Jr.
0 siblings, 2 replies; 5+ messages in thread
From: Li Frank @ 2008-12-08 2:52 UTC (permalink / raw)
To: git
The commit history is:
origin/master
Commit1..Commit2..Commit3(T1 branch).
I want to combined Commit1, Commit2 and Commit3 to one commit_X
and push to origin master and keep old T1 branch history. So I can't
use rebase. T1 branch history will be lost after rebase.
So I create T2 branch at origin/master:
origin/master
Commit1..Commit2..Commit3(T1 branch).
T2 (branch).
Then I use "git merge --no-ff --log T1" merge T1 to T2.
So
origin/master
+--Commit1..Commit2..Commit3(T1 branch). +
+----------------------------------------------------------------+--Comm
itX(T2 branch).
But when I push T2 to origin master, Commit1 ,2, 3 also pushed.
I expect there are only CommitX at origin master branch.
How can I do?
best regards
Frank Li
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can Git push only first parent history commits?
2008-12-08 2:52 Can Git push only first parent history commits? Li Frank
@ 2008-12-08 3:00 ` Junio C Hamano
2008-12-08 3:11 ` Li Frank
2008-12-08 4:03 ` Boyd Stephen Smith Jr.
1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-12-08 3:00 UTC (permalink / raw)
To: Li Frank; +Cc: git
Your drawing nor explanation unfortunately does not make much sense to me,
so I'll respond only to the subject.
Pushing only first parent history would mean that the commits you will be
transferring will still record their true parents, but you are not sending
any parents but the first ones. The repository that receives such a push
would not pass fsck, in other words, you are deliberately corrupting the
repository.
Naturally we won't support such an operation by default.
It is plausible that you can implement an option to do so, but it would
make it hard at the receiving end to tell between a true repository
corruption and a corruption you are deliberately introducing by such a
push, so it won't be useful unless accompanied by a corresponding option
to fsck to make it not complain when parent commits and associated objects
that are not necessary for first parent history.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Can Git push only first parent history commits?
2008-12-08 3:00 ` Junio C Hamano
@ 2008-12-08 3:11 ` Li Frank
2008-12-08 7:44 ` Matthieu Moy
0 siblings, 1 reply; 5+ messages in thread
From: Li Frank @ 2008-12-08 3:11 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
I don't know the detail of git internal. Or my email subject
description have some problem.
I just want to combine some commits to one commit and push combined
commit to remote. And at same time, keep commits history at my local
repository. Rebase will make original history lost.
-----Original Message-----
From: Junio C Hamano [mailto:gitster@pobox.com]
Sent: Monday, December 08, 2008 11:00 AM
To: Li Frank-B20596
Cc: git@vger.kernel.org
Subject: Re: Can Git push only first parent history commits?
Your drawing nor explanation unfortunately does not make much sense to
me, so I'll respond only to the subject.
Pushing only first parent history would mean that the commits you will
be transferring will still record their true parents, but you are not
sending any parents but the first ones. The repository that receives
such a push would not pass fsck, in other words, you are deliberately
corrupting the repository.
Naturally we won't support such an operation by default.
It is plausible that you can implement an option to do so, but it would
make it hard at the receiving end to tell between a true repository
corruption and a corruption you are deliberately introducing by such a
push, so it won't be useful unless accompanied by a corresponding option
to fsck to make it not complain when parent commits and associated
objects that are not necessary for first parent history.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can Git push only first parent history commits?
2008-12-08 3:11 ` Li Frank
@ 2008-12-08 7:44 ` Matthieu Moy
0 siblings, 0 replies; 5+ messages in thread
From: Matthieu Moy @ 2008-12-08 7:44 UTC (permalink / raw)
To: Li Frank; +Cc: Junio C Hamano, git
"Li Frank" <Frank.Li@freescale.com> writes:
> I don't know the detail of git internal. Or my email subject
> description have some problem.
>
> I just want to combine some commits to one commit and push combined
> commit to remote. And at same time, keep commits history at my local
> repository. Rebase will make original history lost.
git merge --squash may help.
--
Matthieu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can Git push only first parent history commits?
2008-12-08 2:52 Can Git push only first parent history commits? Li Frank
2008-12-08 3:00 ` Junio C Hamano
@ 2008-12-08 4:03 ` Boyd Stephen Smith Jr.
1 sibling, 0 replies; 5+ messages in thread
From: Boyd Stephen Smith Jr. @ 2008-12-08 4:03 UTC (permalink / raw)
To: git; +Cc: Li Frank
[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]
On Sunday 07 December 2008, "Li Frank" <Frank.Li@freescale.com> wrote
about 'Can Git push only first parent history commits?':
> The commit history is:
> origin/master
> Commit1..Commit2..Commit3(T1 branch).
>
> I want to combined Commit1, Commit2 and Commit3 to one commit_X
>and push to origin master and keep old T1 branch history. So I can't
>use rebase. T1 branch history will be lost after rebase.
I'm pretty sure you want to do something like this:
git branch T2 T1
git rebase -i master T2
# Editor opens
# Edit commit list to squash 3 commits into 1.
git push origin T2:master
git fetch origin
At the end, you'll have a history that looks like:
*--> origin/master (T2)
\
-> C1 --> C2 --> C3 (T1)
I'm not sure why you'd want to do this though. If the commits don't stand
alone well, they should be squashed on T1 before pushing. If the commits
do stand alone well, the history should preserve them on master as well.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss03@volumehost.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.org/ \_/
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-08 7:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08 2:52 Can Git push only first parent history commits? Li Frank
2008-12-08 3:00 ` Junio C Hamano
2008-12-08 3:11 ` Li Frank
2008-12-08 7:44 ` Matthieu Moy
2008-12-08 4:03 ` Boyd Stephen Smith Jr.
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).