Skip to content

Instantly share code, notes, and snippets.

@bsidhom
Created July 19, 2018 00:10
Show Gist options
  • Save bsidhom/8433b01ce1f92f12cccb2af2af70eea8 to your computer and use it in GitHub Desktop.
Save bsidhom/8433b01ce1f92f12cccb2af2af70eea8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Show the upstream tracking branch for HEAD
git rev-parse --abbrev-ref --symbolic-full-name '@{u}'
# Show the upstream tracking branch for `my-branch`
git rev-parse --abbrev-ref --symbolic-full-name 'my-branch@{u}'
# List each local branch along with its upstream tracking branch
git for-each-ref --format='%(refname:short) <- %(upstream:short)' refs/heads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment