{"thread":{"id":"16629","subject":"Can Git push only first parent history commits?","startedAt":"2008-12-08T02:52:38Z","lastAt":"2008-12-08T07:44:02Z","messageCount":5,"participants":["Li Frank","Junio C Hamano","Boyd Stephen Smith Jr.","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"97322","messageId":"402F4B33D9C9DE4083DB96B416549FAF9E12@zch01exm23.fsl.freescale.net","threadId":"16629","inReplyTo":null,"subject":"Can Git push only first parent history commits?","fromName":"Li Frank","fromEmail":"frank.li@freescale.com","sentAt":"2008-12-08T02:52:38Z","receivedAt":"2008-12-08T02:52:38Z","isPatch":false,"sender":{"key":"frank.li@freescale.com","avatar":null},"body":"        The commit history is: \n        origin/master\n              Commit1..Commit2..Commit3(T1 branch). \n         \n        I want to combined Commit1, Commit2 and Commit3 to one commit_X\nand push to origin master and keep old T1 branch history.  So I can't\nuse rebase.  T1 branch history will be lost after rebase. \n        So I create T2 branch at origin/master:\n\t\n        origin/master\n              Commit1..Commit2..Commit3(T1 branch). \n\t  T2 (branch).\n\n        Then I use \"git merge --no-ff --log T1\" merge T1 to T2.  \n        So \n\t  origin/master\n              \t+--Commit1..Commit2..Commit3(T1 branch). +\n\n\t\n+----------------------------------------------------------------+--Comm\nitX(T2 branch).\n\n       But when I push T2 to origin master, Commit1 ,2, 3 also pushed.\nI expect there are only CommitX at origin master branch. \n       How can I do?\n \nbest regards\nFrank Li\n"},{"id":"97326","messageId":"7v7i6bbcc6.fsf@gitster.siamese.dyndns.org","threadId":"16629","inReplyTo":"402F4B33D9C9DE4083DB96B416549FAF9E12@zch01exm23.fsl.freescale.net","subject":"Re: Can Git push only first parent history commits?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-08T03:00:25Z","receivedAt":"2008-12-08T03:00:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Your drawing nor explanation unfortunately does not make much sense to me,\nso I'll respond only to the subject.\n\nPushing only first parent history would mean that the commits you will be\ntransferring will still record their true parents, but you are not sending\nany parents but the first ones.  The repository that receives such a push\nwould not pass fsck, in other words, you are deliberately corrupting the\nrepository.\n\nNaturally we won't support such an operation by default.\n\nIt is plausible that you can implement an option to do so, but it would\nmake it hard at the receiving end to tell between a true repository\ncorruption and a corruption you are deliberately introducing by such a\npush, so it won't be useful unless accompanied by a corresponding option\nto fsck to make it not complain when parent commits and associated objects\nthat are not necessary for first parent history.\n"},{"id":"97328","messageId":"402F4B33D9C9DE4083DB96B416549FAF9E2D@zch01exm23.fsl.freescale.net","threadId":"16629","inReplyTo":"7v7i6bbcc6.fsf@gitster.siamese.dyndns.org","subject":"RE: Can Git push only first parent history commits?","fromName":"Li Frank","fromEmail":"frank.li@freescale.com","sentAt":"2008-12-08T03:11:30Z","receivedAt":"2008-12-08T03:11:30Z","isPatch":false,"sender":{"key":"frank.li@freescale.com","avatar":null},"body":"I don't know the detail of git internal.  Or my email subject\ndescription have some problem. \n \nI just want to combine some commits to one commit and push combined\ncommit to remote.  And at same time, keep commits history at my local\nrepository.  Rebase will make original history lost. \n \n\n-----Original Message-----\nFrom: Junio C Hamano [mailto:gitster@pobox.com] \nSent: Monday, December 08, 2008 11:00 AM\nTo: Li Frank-B20596\nCc: git@vger.kernel.org\nSubject: Re: Can Git push only first parent history commits?\n\nYour drawing nor explanation unfortunately does not make much sense to\nme, so I'll respond only to the subject.\n\nPushing only first parent history would mean that the commits you will\nbe transferring will still record their true parents, but you are not\nsending any parents but the first ones.  The repository that receives\nsuch a push would not pass fsck, in other words, you are deliberately\ncorrupting the repository.\n\nNaturally we won't support such an operation by default.\n\nIt is plausible that you can implement an option to do so, but it would\nmake it hard at the receiving end to tell between a true repository\ncorruption and a corruption you are deliberately introducing by such a\npush, so it won't be useful unless accompanied by a corresponding option\nto fsck to make it not complain when parent commits and associated\nobjects that are not necessary for first parent history.\n"},{"id":"97330","messageId":"200812072203.24996.bss03@volumehost.net","threadId":"16629","inReplyTo":"402F4B33D9C9DE4083DB96B416549FAF9E12@zch01exm23.fsl.freescale.net","subject":"Re: Can Git push only first parent history commits?","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss03@volumehost.net","sentAt":"2008-12-08T04:03:20Z","receivedAt":"2008-12-08T04:03:20Z","isPatch":false,"sender":{"key":"bss03@volumehost.net","avatar":"https://gravatar.com/avatar/74fa10b37dfd44462a6a30c4d4e3bda26ab7991ddb0d8ab24b022714a8ecb918?d=mp&s=160"},"body":"On Sunday 07 December 2008, \"Li Frank\" <Frank.Li@freescale.com> wrote \nabout 'Can Git push only first parent history commits?':\n>        The commit history is:\n>        origin/master\n>              Commit1..Commit2..Commit3(T1 branch).\n>\n>        I want to combined Commit1, Commit2 and Commit3 to one commit_X\n>and push to origin master and keep old T1 branch history.  So I can't\n>use rebase.  T1 branch history will be lost after rebase.\n\nI'm pretty sure you want to do something like this:\ngit branch T2 T1\ngit rebase -i master T2\n# Editor opens\n# Edit commit list to squash 3 commits into 1.\ngit push origin T2:master\ngit fetch origin\n\nAt the end, you'll have a history that looks like:\n*--> origin/master (T2)\n \\\n  -> C1 --> C2 --> C3 (T1)\n\nI'm not sure why you'd want to do this though.  If the commits don't stand \nalone well, they should be squashed on T1 before pushing.  If the commits \ndo stand alone well, the history should preserve them on master as well.\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss03@volumehost.net                      ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.org/                      \\_/     \n"},{"id":"97338","messageId":"vpqabb7az7h.fsf@bauges.imag.fr","threadId":"16629","inReplyTo":"402F4B33D9C9DE4083DB96B416549FAF9E2D@zch01exm23.fsl.freescale.net","subject":"Re: Can Git push only first parent history commits?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2008-12-08T07:44:02Z","receivedAt":"2008-12-08T07:44:02Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"Li Frank\" <Frank.Li@freescale.com> writes:\n\n> I don't know the detail of git internal.  Or my email subject\n> description have some problem. \n>  \n> I just want to combine some commits to one commit and push combined\n> commit to remote.  And at same time, keep commits history at my local\n> repository.  Rebase will make original history lost. \n\ngit merge --squash may help.\n\n-- \nMatthieu\n"}]}