Skip to content

Instantly share code, notes, and snippets.

@Nekroze
Created May 16, 2018 04:17
Show Gist options
  • Save Nekroze/93a261cfd661b39a861ccb6d19de4a9a to your computer and use it in GitHub Desktop.
Save Nekroze/93a261cfd661b39a861ccb6d19de4a9a to your computer and use it in GitHub Desktop.
Should output the closest git branch on origin remote to the currently checked out commit
git log --pretty=format:'%d' --abbrev-commit | grep -oE "origin\/\w+(_\w+)?" | head -n 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment