{"thread":{"id":"43108","subject":"Re: check if a commit is ascendent of a specific commit","startedAt":"2006-11-11T11:08:56Z","lastAt":"2006-11-11T20:12:42Z","messageCount":8,"participants":["Nguyen Thai Ngoc Duy","Junio C Hamano","Karl Hasselström","Jakub Narebski","Tom Prince"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"295780","messageId":"fcaeb9bf0611110308l577d70bfo5046d7d7eb09ac58@mail.gmail.com","threadId":"43108","inReplyTo":null,"subject":"check if a commit is ascendent of a specific commit","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-11-11T11:08:56Z","receivedAt":"2006-11-11T11:08:56Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\nI want to create \"git-amend-commit\" to be able to amend commits before\nHEAD. So I need to check whether the commit I'm going to amend is\nascendent of HEAD. Is there any way to check that?\n-- \n"},{"id":"297063","messageId":"ej4ba6$oqt$1@sea.gmane.org","threadId":"43108","inReplyTo":"fcaeb9bf0611110308l577d70bfo5046d7d7eb09ac58@mail.gmail.com","subject":"Re: check if a commit is ascendent of a specific commit","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-11T11:15:13Z","receivedAt":"2006-11-11T11:15:13Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Nguyen Thai Ngoc Duy wrote:\n\n> Hi,\n> I want to create \"git-amend-commit\" to be able to amend commits before\n> HEAD. So I need to check whether the commit I'm going to amend is\n> ascendent of HEAD. Is there any way to check that?\n\nYou can only amend topmost commit in any branch. Anything else would\nbe rewriting history, starting from amended commit upwards in lineage\n(parentage).\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"293855","messageId":"fcaeb9bf0611110319i680a3805l5f6e6059644642ea@mail.gmail.com","threadId":"43108","inReplyTo":"fcaeb9bf0611110308l577d70bfo5046d7d7eb09ac58@mail.gmail.com","subject":"Re: check if a commit is ascendent of a specific commit","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2006-11-11T11:19:30Z","receivedAt":"2006-11-11T11:19:30Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 11/11/06, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> Hi,\n> I want to create \"git-amend-commit\" to be able to amend commits before\n> HEAD. So I need to check whether the commit I'm going to amend is\n> ascendent of HEAD. Is there any way to check that?\n\nForget it. It's git-merge-base. Sorry for the noise\n\n-- \n"},{"id":"297725","messageId":"200611111256.20157.jnareb@gmail.com","threadId":"43108","inReplyTo":"fcaeb9bf0611110331q53522c50sda399d4a7916636d@mail.gmail.com","subject":"Re: check if a commit is ascendent of a specific commit","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-11T11:56:19Z","receivedAt":"2006-11-11T11:56:19Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia sobota 11. listopada 2006 12:31, Nguyen Thai Ngoc Duy napisał:\n> On 11/11/06, Jakub Narebski <jnareb@gmail.com> wrote:\n>> You can only amend topmost commit in any branch. Anything else would\n>> be rewriting history, starting from amended commit upwards in lineage\n>> (parentage).\n> \n> Yes. That's what I want. I am tempted to edit older commits just\n> because I forgot to add some entries to .gitignore that I should have\n> added sooner :-)\n\nIn pure git you would have to create new branch at the commit you want\nto amend, amend the commit (in this branch), and rebase (or cherry-pick\nif you need to edit other commits too) the rest, then rename branch.\nOr if you don't want ot loose reflog, tag/branch current branch, then reset\n(rewind) current branch to the commit you want to amend, then cherry-pick.\n\nOr you can use cg-admin-rewritehist tool from Cogito.\n\nSee: http://git.or.cz/gitwiki/GitTips\n-- \nJakub Narebski\n"},{"id":"295593","messageId":"20061111121259.GB11224@diana.vm.bytemark.co.uk","threadId":"43108","inReplyTo":"200611111256.20157.jnareb@gmail.com","subject":"Re: check if a commit is ascendent of a specific commit","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-11T12:12:59Z","receivedAt":"2006-11-11T12:12:59Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-11 12:56:19 +0100, Jakub Narebski wrote:\n\n> Dnia sobota 11. listopada 2006 12:31, Nguyen Thai Ngoc Duy napisa??:\n>\n> > Yes. That's what I want. I am tempted to edit older commits just\n> > because I forgot to add some entries to .gitignore that I should\n> > have added sooner :-)\n>\n> In pure git you would have to create new branch at the commit you\n> want to amend, amend the commit (in this branch), and rebase (or\n> cherry-pick if you need to edit other commits too) the rest, then\n> rename branch. Or if you don't want ot loose reflog, tag/branch\n> current branch, then reset (rewind) current branch to the commit you\n> want to amend, then cherry-pick.\n>\n> Or you can use cg-admin-rewritehist tool from Cogito.\n\nIn case the history you want to edit is linear (that is, merge-free),\nStGIT is an excellent tool. It is very easy to go back to a previous\ncommit (stg pop), amend it (stg refresh), and replay the following\ncommits on top of the amended commit (stg push).\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"298732","messageId":"7virhlken0.fsf@assigned-by-dhcp.cox.net","threadId":"43108","inReplyTo":"fcaeb9bf0611110308l577d70bfo5046d7d7eb09ac58@mail.gmail.com","subject":"Re: check if a commit is ascendent of a specific commit","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-11T18:43:47Z","receivedAt":"2006-11-11T18:43:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com> writes:\n\n> Hi,\n> I want to create \"git-amend-commit\" to be able to amend commits before\n> HEAD. So I need to check whether the commit I'm going to amend is\n> ascendent of HEAD. Is there any way to check that?\n\nAscendant is a word from astorology -- you mean ancestor ;-).\n\n\"git-merge-base A B === A\" when A is an ancestor of B.\n\nProvided if the history between A and B is linear, and you do\nnot have trouble making your co-workers adjusting to your\nhistory change after A (including the cases where you do not\nhave any co-workers or you have not made history between A and B\npublic), you could do one of these three things:\n\n - use \"stg uncommit\" until you pop A, make a change there and\n   \"stg refresh\", and then \"stg push\" everything back.\n\n - \"git format-patch A && git reset --hard A\", edit the patches\n   and then \"git am\" them.\n\n - \"git tag -f Anchor && git reset --hard A\", edit and \"git\n   commit --amend\".  Look at \"git show-branch Anchor HEAD\", and\n   repeatedly \"git cherry-pick Anchor~$n\" from older to newer\n   from Anchor, and then \"git tag -d Anchor\".\n\n\n\n\n\n"},{"id":"297692","messageId":"20061111192321.GJ4862@socrates.priv","threadId":"43108","inReplyTo":"7virhlken0.fsf@assigned-by-dhcp.cox.net","subject":"Re: check if a commit is ascendent of a specific commit","fromName":"Tom Prince","fromEmail":"tom.prince@ualberta.net","sentAt":"2006-11-11T19:23:21Z","receivedAt":"2006-11-11T19:23:21Z","isPatch":false,"sender":{"key":"tom.prince@ualberta.net","avatar":"https://gravatar.com/avatar/a0ad19caee7618876339485106ec994f5202505eecd210ba5c0bd869feaa555a?d=mp&s=160"},"body":"On Sat, Nov 11, 2006 at 10:43:47AM -0800, Junio C Hamano wrote:\n> \"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com> writes:\n> \n> > Hi,\n> > I want to create \"git-amend-commit\" to be able to amend commits before\n> > HEAD. So I need to check whether the commit I'm going to amend is\n> > ascendent of HEAD. Is there any way to check that?\n> \n> Ascendant is a word from astorology -- you mean ancestor ;-).\n\n"},{"id":"295493","messageId":"7v64dlkait.fsf@assigned-by-dhcp.cox.net","threadId":"43108","inReplyTo":"20061111192321.GJ4862@socrates.priv","subject":"Re: check if a commit is ascendent of a specific commit","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-11T20:12:42Z","receivedAt":"2006-11-11T20:12:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tom Prince <tom.prince@ualberta.net> writes:\n\n> On Sat, Nov 11, 2006 at 10:43:47AM -0800, Junio C Hamano wrote:\n>> \"Nguyen Thai Ngoc Duy\" <pclouds@gmail.com> writes:\n>> \n>> > Hi,\n>> > I want to create \"git-amend-commit\" to be able to amend commits before\n>> > HEAD. So I need to check whether the commit I'm going to amend is\n>> > ascendent of HEAD. Is there any way to check that?\n>> \n>> Ascendant is a word from astorology -- you mean ancestor ;-).\n>\n> Or antecedent.\n\nSorry, there is no \"or\" here -- check our documentation ;-).\n"}]}