Re:More Productive Git
by dearrifling on Friday May 24, 2019 @04:43PM
(#20005116)
On debian this is the default behavior.
Same in Ubuntu.
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.
Fun fact: Ubuntu is a derivative of Debian!
Yeah, but they also have added some stuff that is not part of standard Debian.
Re:More Productive Git
by paulddraper on Friday May 24, 2019 @05:13PM
(#20005328)
git has a whole bash library for autocompletion stuff (like complete ref, complete tree). You can even use it when writing your own commands.
If you're on macOS, update your bash and install bash-completions and git. The path above is likely wrong if you're using a package manager: for MacPorts you want to source /opt/local/etc/profile.d/bash_completion.sh, and for Homebrew it's $(brew --prefix)/share/bash-completion/bash_completion (the install process will tell you what to use).
My brew has it in /usr/local/etc/bash_completion.d/
That seems to be a legacy thing: https://github.com/Homebrew/homebrew-core/blob/master/Formul...
Re:More Productive Git
by GauntletWizard on Friday May 24, 2019 @04:47PM
(#20005142)
Here's mine:
[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.
Re:More Productive Git
by BinaryIdiot on Friday May 24, 2019 @04:45PM
(#20005130)
I don't know why I never thought to look for more completions for git. This is a great tip!
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.