Created
June 17, 2011 15:34
-
-
Save Olical/1031652 to your computer and use it in GitHub Desktop.
Git branch / tag/ remote / command terminal completion. Drop it into your bash profile
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
| _complete_git() { | |
| if [ -d .git ]; then | |
| branches=`git branch -a | cut -c 3-` | |
| tags=`git tag` | |
| remotes=`git remote` | |
| commands="add bisect branch checkout clone commit diff fetch grep init log merge mv pull push rebase reset rm show status tag stash pop" | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| COMPREPLY=( $(compgen -W "${branches} ${tags} ${remotes} ${commands}" -- ${cur}) ) | |
| fi | |
| } | |
| complete -F _complete_git git checkout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this was made a long time ago, but I just discovered it and it resolved a small, but palpable pain point of mine. Thank you 🙏