Created
August 29, 2013 15:38
-
-
Save marek-saji/6379708 to your computer and use it in GitHub Desktop.
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 characters
#!/bin/sh | |
# Show from which one of integration branches does current branch grows from | |
# (c) Marek `saji` Augustynowicz | |
# | |
# INSTALL: | |
# git config alias.grows-from '!sh .git/bin/grows-from.sh' | |
# | |
# USAGE: | |
# git grows-from [<commit>] | |
DEVEL_BASE="$( command git merge-base ${1:-HEAD} devel )" | |
NEXT_BASE="$( command git merge-base ${1:-HEAD} next )" | |
MASTER_BASE="$( command git merge-base ${1:-HEAD} master )" | |
FIRST_BASE=$( command git log --pretty=format:%H --max-count=1 $MASTER_BASE $NEXT_BASE $DEVEL_BASE ) | |
case $FIRST_BASE in | |
$DEVEL_BASE ) echo devel ;; | |
$NEXT_BASE ) echo next ;; | |
$MASTER_BASE ) echo master ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment