Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 20 lines (15 sloc) 487 Bytes
#!/bin/bash
# Usage: git qparent [rev]
#
# Like |hg qparent|, gives last common revision between |rev| and upstream. If
# |rev| is not given, we let rev equal HEAD.
#
# The upstream branch is set via git branch --set-upstream <branch> <upstream>.
# If no upstream branch has been explicitly set, we use origin/master.
set -e
export PATH="$(dirname "$0"):$PATH"
if [[ "$1" == "" ]]; then
git merge-base HEAD "$(git tracks -d)"
else
git merge-base "$1" "$(git tracks -d "$1")"
fi