Permalink
Browse files

git-out: allow specifying a remote/branch to compare against

  • Loading branch information...
1 parent 3ee9ece commit 583053ed5a24e34a2150d1c1dd3f8267cae77efe @falconindy committed Dec 16, 2011
Showing with 10 additions and 4 deletions.
  1. +10 −4 git-out
View
@@ -13,11 +13,17 @@ if [[ -z $curbranch ]]; then
exit 1
fi
-remote=$(git config "branch.$curbranch.remote" 2>/dev/null || echo "origin")
-remote=${remote##*/}
+[[ $1 ]] && IFS='/' read -r remote merge <<< "$1"
-merge=$(git config "branch.$curbranch.merge" 2>/dev/null || echo "$curbranch")
-merge=${merge##*/?(+)}
+if [[ -z $remote ]]; then
+ remote=$(git config "branch.$curbranch.remote" 2>/dev/null || echo "origin")
+ remote=${remote##*/}
+fi
+
+if [[ -z $merge ]]; then
+ merge=$(git config "branch.$curbranch.merge" 2>/dev/null || echo "$curbranch")
+ merge=${merge##*/?(+)}
+fi
printf 'Comparing with %s/%s\n' "${remote:-origin}" "${merge:-master}"
git cherry -v ${remote:-origin}/${merge:-master}

0 comments on commit 583053e

Please sign in to comment.