Last active
July 24, 2017 05:42
-
-
Save oldratlee/519eeddc22bd2724629225d44beb1adb to your computer and use it in GitHub Desktop.
checkout most recent modified branch
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
gcor() { | |
# http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit | |
# --sort=-committerdate : sort branch by commit date in descending order | |
# --sort=committerdate : sort branch by commit date in ascending order | |
git branch -a --sort=committerdate "$@" | | |
awk -F'remotes/origin/' '/remotes\/origin\//{print $2}' | | |
tail -1 | | |
xargs git checkout | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment