SHARE:
Uncategorized

Fumbling Around in Git With Fat Fingers

Flatiron School / 11 June 2013

The following is a guest post by Micah Corn and originally appeared on his blog. Micah is currently a student at The Flatiron School. You can follow him on Twitter here.

As a babe in this programming excursion, I am always looking for help while I tool around. This has been very true with my playtime with ‘Git’. On Friday I wanted to find out if there is a tab-completion ability in Git. This led me down a trail that revealed a precious jewel, for me at least.

Having tab completion allows quick command searching and tab completion of branch names. See the following screenshot for a command search.

Auto completion/tab completion

  • go to the Github Git Source Page
  • within the git directory you want to find the contrib directory
  • within contrib directory you want to find the completion directory
  • I am using bash so I need the bash file, but for Zsh, use the Zsh file.
  • click on the file that corresponds to it git-completion.bash
  • next click on the raw button to remove formatting and then select all of the text
  • create a file in your home directory called .git-completion.bash and paste in the text
  • inside of your .bash_profile file, add the line ‘source ~/.git-completion.bash

Once these steps are completed you can get into a git directory and type in ‘git’. Make sure you have a space after git and you can either press tab, or begin the next word and tab from there. You can auto complete words you are typing and also use it as a look-up tool.

There seems to a bug for me where I have to tab twice to get it working, but it could be like me where a little prodding goes a long way.

Use with care and if there is a better way let me know.

Prelude to Coding Previous Post Guest Speaker: Sandi Metz Next Post