Naming git branches is something most of us have down to a science. My branch naming pattern is usually {issue number}-short-feature-description, though many developers prefer to lead with the description and end with the issue.
Regardless of the pattern you use, having a feature like autocomplete can save you a lot of time typing or copy/pasting. Here's how you can implement autocomplete for git branches!
Start by downloading the git-completion.sh file from GitHub:
Next, add the following to your ~/.bash_profile file:
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
The last step is restarting your terminal. Voila! Now you can type git checkout {search-string} and press tab to select the lone branch that matches or hit tab again to see all matches!
Autocomplete for git makes navigating all of my branches much faster!
I love almost every part of being a tech blogger: learning, preaching, bantering, researching. The one part about blogging that I absolutely loathe: dealing with SPAM comments. For the past two years, my blog has registered 8,000+ SPAM comments per day. PER DAY. Bloating my database...
Sooner or later you'll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...
CSS class name structure and consistency is really important; some developers camelcase classnames, others use dashes, and others use underscores. One thing I've learned when toying around by HTML and CSS class names is that you can actually use unicode symbols and icons as classnames.
I'm a big fan of video games. I don't get much time to play them but I'll put down the MacBook Pro long enough to get a few games in. One of my favorites is Portal. For those who don't know, what's...
Discussion
JONATHAN DOS SANTOS
this needs to find it’s way into official distribuition!
Andras Somi
If you use zsh + oh-my-zsh, you can get the same effect with the git plugin.
Djibril
Can probably run source ~/.bash_profile if you don’t want to restart your terminal
this needs to find it’s way into official distribuition!
If you use zsh + oh-my-zsh, you can get the same effect with the git plugin.
Can probably run
source ~/.bash_profile
if you don’t want to restart your terminal