Last active
April 5, 2022 08:01
Revisions
-
simonwhitaker revised this gist
Aug 27, 2013 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,9 @@ # [alias] # is-ancestor = !/path/to/git-is-ancestor # # Then use thus: # # $ git is-ancestor rev1 rev2 script_name=$(basename $0) -
simonwhitaker renamed this gist
Aug 27, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
simonwhitaker created this gist
Aug 27, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ #!/bin/bash # # git-is-ancestor, by Simon Whitaker # # Suggested usage # # Store this file somewhere, make it executable, then alias # it to git is-ancestor by putting this in your $HOME/.gitconfig: # # [alias] # is-ancestor = !/path/to/git-is-ancestor # script_name=$(basename $0) usage() { cat << EOF >&2 usage: ${script_name} <REV1> <REV2> EOF } if [ $# -ne 2 ]; then usage exit 2 fi if $( git merge-base --is-ancestor $1 $2 ); then echo "$1 is an ancestor of $2" exit 0 elif $( git merge-base --is-ancestor $2 $1 ); then echo "$2 is an ancestor of $1" exit 0 else echo "$1 and $2 are not related" exit 1 fi