Created
June 30, 2021 17:02
-
-
Save yusefnapora/01fed85eada0e59baa57f3ca2dfa6669 to your computer and use it in GitHub Desktop.
git aliases to checkout the head branch of a repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
upstream-name = !git remote | egrep -o '(upstream|origin)' | tail -1 | |
head-branch = !basename $(git symbolic-ref refs/remotes/$(git upstream-name)/HEAD) | |
cm = !git checkout $(git head-branch) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment