News for hackers. Stuff that matters.
Re:More Productive Git by no_gravity on Friday May 24, 2019 @04:19PM (#20004917)
Put this in your bashrc:

    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.

Re:More Productive Git by dearrifling on Friday May 24, 2019 @04:43PM (#20005116)
On debian this is the default behavior.
Re:More Productive Git by panpanna on Friday May 24, 2019 @04:56PM (#20005223)
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.

Re:More Productive Git by johnhenry on Friday May 24, 2019 @05:58PM (#20005649)
Fun fact: Ubuntu is a derivative of Debian!
Re:More Productive Git by panpanna on Friday May 24, 2019 @06:02PM (#20005679)
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.
Re:More Productive Git by saagarjha on Friday May 24, 2019 @05:26PM (#20005422)
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).
Re:More Productive Git by emmelaich on Friday May 24, 2019 @08:36PM (#20006413)
My brew has it in /usr/local/etc/bash_completion.d/
Re:More Productive Git by saagarjha on Saturday May 25, 2019 @12:38AM (#20007113)
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.
Re:More Productive Git by Seb-C on Sunday May 26, 2019 @10:31PM (#20019001)

  [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!