Re: check if a commit is ascendent of a specific commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Nguyen Thai Ngoc Duy" <pclouds@xxxxxxxxx> 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".






-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]