* check if a commit is ascendent of a specific commit
@ 2006-11-11 11:08 Nguyen Thai Ngoc Duy
2006-11-11 11:15 ` Jakub Narebski
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2006-11-11 11:08 UTC (permalink / raw)
To: git
Hi,
I want to create "git-amend-commit" to be able to amend commits before
HEAD. So I need to check whether the commit I'm going to amend is
ascendent of HEAD. Is there any way to check that?
--
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: check if a commit is ascendent of a specific commit 2006-11-11 11:08 check if a commit is ascendent of a specific commit Nguyen Thai Ngoc Duy @ 2006-11-11 11:15 ` Jakub Narebski [not found] ` <fcaeb9bf0611110331q53522c50sda399d4a7916636d@mail.gmail.com> 2006-11-11 11:19 ` Nguyen Thai Ngoc Duy 2006-11-11 18:43 ` Junio C Hamano 2 siblings, 1 reply; 8+ messages in thread From: Jakub Narebski @ 2006-11-11 11:15 UTC (permalink / raw) To: git Nguyen Thai Ngoc Duy wrote: > Hi, > I want to create "git-amend-commit" to be able to amend commits before > HEAD. So I need to check whether the commit I'm going to amend is > ascendent of HEAD. Is there any way to check that? You can only amend topmost commit in any branch. Anything else would be rewriting history, starting from amended commit upwards in lineage (parentage). -- Jakub Narebski Warsaw, Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <fcaeb9bf0611110331q53522c50sda399d4a7916636d@mail.gmail.com>]
* Re: check if a commit is ascendent of a specific commit [not found] ` <fcaeb9bf0611110331q53522c50sda399d4a7916636d@mail.gmail.com> @ 2006-11-11 11:56 ` Jakub Narebski 2006-11-11 12:12 ` Karl Hasselström 0 siblings, 1 reply; 8+ messages in thread From: Jakub Narebski @ 2006-11-11 11:56 UTC (permalink / raw) To: Nguyen Thai Ngoc Duy; +Cc: git Dnia sobota 11. listopada 2006 12:31, Nguyen Thai Ngoc Duy napisał: > On 11/11/06, Jakub Narebski <jnareb@gmail.com> wrote: >> You can only amend topmost commit in any branch. Anything else would >> be rewriting history, starting from amended commit upwards in lineage >> (parentage). > > Yes. That's what I want. I am tempted to edit older commits just > because I forgot to add some entries to .gitignore that I should have > added sooner :-) In pure git you would have to create new branch at the commit you want to amend, amend the commit (in this branch), and rebase (or cherry-pick if you need to edit other commits too) the rest, then rename branch. Or if you don't want ot loose reflog, tag/branch current branch, then reset (rewind) current branch to the commit you want to amend, then cherry-pick. Or you can use cg-admin-rewritehist tool from Cogito. See: http://git.or.cz/gitwiki/GitTips -- Jakub Narebski ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: check if a commit is ascendent of a specific commit 2006-11-11 11:56 ` Jakub Narebski @ 2006-11-11 12:12 ` Karl Hasselström 0 siblings, 0 replies; 8+ messages in thread From: Karl Hasselström @ 2006-11-11 12:12 UTC (permalink / raw) To: Jakub Narebski; +Cc: Nguyen Thai Ngoc Duy, git On 2006-11-11 12:56:19 +0100, Jakub Narebski wrote: > Dnia sobota 11. listopada 2006 12:31, Nguyen Thai Ngoc Duy napisa??: > > > Yes. That's what I want. I am tempted to edit older commits just > > because I forgot to add some entries to .gitignore that I should > > have added sooner :-) > > In pure git you would have to create new branch at the commit you > want to amend, amend the commit (in this branch), and rebase (or > cherry-pick if you need to edit other commits too) the rest, then > rename branch. Or if you don't want ot loose reflog, tag/branch > current branch, then reset (rewind) current branch to the commit you > want to amend, then cherry-pick. > > Or you can use cg-admin-rewritehist tool from Cogito. In case the history you want to edit is linear (that is, merge-free), StGIT is an excellent tool. It is very easy to go back to a previous commit (stg pop), amend it (stg refresh), and replay the following commits on top of the amended commit (stg push). -- Karl Hasselström, kha@treskal.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: check if a commit is ascendent of a specific commit 2006-11-11 11:08 check if a commit is ascendent of a specific commit Nguyen Thai Ngoc Duy 2006-11-11 11:15 ` Jakub Narebski @ 2006-11-11 11:19 ` Nguyen Thai Ngoc Duy 2006-11-11 18:43 ` Junio C Hamano 2 siblings, 0 replies; 8+ messages in thread From: Nguyen Thai Ngoc Duy @ 2006-11-11 11:19 UTC (permalink / raw) To: git On 11/11/06, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote: > Hi, > I want to create "git-amend-commit" to be able to amend commits before > HEAD. So I need to check whether the commit I'm going to amend is > ascendent of HEAD. Is there any way to check that? Forget it. It's git-merge-base. Sorry for the noise -- ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: check if a commit is ascendent of a specific commit 2006-11-11 11:08 check if a commit is ascendent of a specific commit Nguyen Thai Ngoc Duy 2006-11-11 11:15 ` Jakub Narebski 2006-11-11 11:19 ` Nguyen Thai Ngoc Duy @ 2006-11-11 18:43 ` Junio C Hamano 2006-11-11 19:23 ` Tom Prince 2 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2006-11-11 18:43 UTC (permalink / raw) To: Nguyen Thai Ngoc Duy; +Cc: git "Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes: > Hi, > I want to create "git-amend-commit" to be able to amend commits before > HEAD. So I need to check whether the commit I'm going to amend is > ascendent of HEAD. Is there any way to check that? Ascendant is a word from astorology -- you mean ancestor ;-). "git-merge-base A B === A" when A is an ancestor of B. Provided if the history between A and B is linear, and you do not have trouble making your co-workers adjusting to your history change after A (including the cases where you do not have any co-workers or you have not made history between A and B public), you could do one of these three things: - use "stg uncommit" until you pop A, make a change there and "stg refresh", and then "stg push" everything back. - "git format-patch A && git reset --hard A", edit the patches and then "git am" them. - "git tag -f Anchor && git reset --hard A", edit and "git commit --amend". Look at "git show-branch Anchor HEAD", and repeatedly "git cherry-pick Anchor~$n" from older to newer from Anchor, and then "git tag -d Anchor". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: check if a commit is ascendent of a specific commit 2006-11-11 18:43 ` Junio C Hamano @ 2006-11-11 19:23 ` Tom Prince 2006-11-11 20:12 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Tom Prince @ 2006-11-11 19:23 UTC (permalink / raw) To: git On Sat, Nov 11, 2006 at 10:43:47AM -0800, Junio C Hamano wrote: > "Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes: > > > Hi, > > I want to create "git-amend-commit" to be able to amend commits before > > HEAD. So I need to check whether the commit I'm going to amend is > > ascendent of HEAD. Is there any way to check that? > > Ascendant is a word from astorology -- you mean ancestor ;-). ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: check if a commit is ascendent of a specific commit 2006-11-11 19:23 ` Tom Prince @ 2006-11-11 20:12 ` Junio C Hamano 0 siblings, 0 replies; 8+ messages in thread From: Junio C Hamano @ 2006-11-11 20:12 UTC (permalink / raw) To: Tom Prince; +Cc: git Tom Prince <tom.prince@ualberta.net> writes: > On Sat, Nov 11, 2006 at 10:43:47AM -0800, Junio C Hamano wrote: >> "Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes: >> >> > Hi, >> > I want to create "git-amend-commit" to be able to amend commits before >> > HEAD. So I need to check whether the commit I'm going to amend is >> > ascendent of HEAD. Is there any way to check that? >> >> Ascendant is a word from astorology -- you mean ancestor ;-). > > Or antecedent. Sorry, there is no "or" here -- check our documentation ;-). ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-11-11 20:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-11 11:08 check if a commit is ascendent of a specific commit Nguyen Thai Ngoc Duy
2006-11-11 11:15 ` Jakub Narebski
[not found] ` <fcaeb9bf0611110331q53522c50sda399d4a7916636d@mail.gmail.com>
2006-11-11 11:56 ` Jakub Narebski
2006-11-11 12:12 ` Karl Hasselström
2006-11-11 11:19 ` Nguyen Thai Ngoc Duy
2006-11-11 18:43 ` Junio C Hamano
2006-11-11 19:23 ` Tom Prince
2006-11-11 20:12 ` Junio C Hamano
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).