by no_gravity · 7y ago · 0 comments
source /usr/share/bash-completion/completions/git
And you can type "git br<tab>" to write "git branch", "git checkout fun<tab>" to write "git checkout funky-feature", "git log --na<tab>" to write "git log --name-only" etc.Pretty much every time you press <tab> somewhere while writing a git command, it does the right type of completion. And hitting <tab> multiple times lets you toggle through the options. So you learn git along the way.
This was one of my most enjoyable productivity jumps when it comes to using git.
Bash completion on Ubuntu/debian is out of this world. I can do things like
lxc exec <TAB>
and get a list of currently running containers.
[alias]
git = !cd -- ${GIT_PREFIX:-.} && git
This turns my most common typo (starting to type a git command, thinking about it, typing 'git' again) into what I wanted it to be. [help]
autocorrect = 1
This one is very useful too.