Skip to content

Instantly share code, notes, and snippets.

@jmatsu
Last active December 19, 2015 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmatsu/6f8d5415fc5c02f158be to your computer and use it in GitHub Desktop.
Save jmatsu/6f8d5415fc5c02f158be to your computer and use it in GitHub Desktop.
git rev-list --left-right $(git rev-parse --abbrev-ref HEAD)...$(git rev-parse --abbrev-ref $(git rev-parse --abbrev-ref HEAD)@{upstream})|tail -1|sed 's/^<//'
current_branch=$(git rev-parse --abbrev-ref HEAD)
tracked_branch=$(git rev-parse --abbrev-ref ${current_branch}@{upstream})
git rev-list --left-right ${current_branch}...${tracked_branch}|tail -1|sed 's/^<//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment