At a new job my coworkers flamed me for not having git bash-completion in my terminal (Lol, really though). Well, they could have asked me in a nicer way hehe, but I shall still be thanking them for helping me to make my command line even more awesome! By the way, I added git bash-completion as a step in my ultimate pretty command line guide which you should definitely check out if you haven't already, but this post is specifically about git bash-completion and why you should use it, and I hope by the end of it you have git bash-completion installed in your terminal too! 😉
Especially when you work on a team that likes to user super long git branch names **cough cough**, but even when you don't it gets pretty annoying typing out your branch names every time and not getting any auto-completion help the way you do with linux commands like "cd". Well, actually that is a thing, it's called "git bash-completion", and it's actually pretty easy to set up! So, you should do get it! 😊
Confession: I have spent years working on the command line typing out branch names without git branch-completion, and sometimes I shed a few tears at night wishing I could get some of those keystrokes back. Sign. So, don't make that same mistake I did, and if you already then have hten at least don't continue making it! Install git bash-completion today! (I'm not a salesperson for git bash-completion, I swear!)
So before you can use git bash-completion you need to install it- seems like a logical prerequisite, eh? My favorite way to install it is through brew:
Just in case this command fails, if you are on linux/window, or maybe you just have something against brew and want to use macports, there is a great first answer on this stack overflow question that should get you going in the right direction.
Edit your "~/.bash_profile" file (or create it if you don't have one) and add this single line to get git bash-completion going:
That's it, and now you should have git bash-completion! Remember that you'll need to run "source ~/.bash_profile" or just boot up a new terminal window to see the changes to your .bash_profile reflected!
Now that you have git bash-completion don't forget to use it all the time and wow all your friends who don't yet know about it!
HD video version (for your viewing pleasures)
Gif version (for practical purposes)
The posts on this site are written and maintained by Jim Lynch. About Jim...