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:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
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!
CSS @supports
Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn’t been available within CSS. What we end up doing is repeating the same properties multiple times with each browser prefix. Yuck. Another thing we…
5 HTML5 APIs You Didn’t Know Existed
When you say or read “HTML5”, you half expect exotic dancers and unicorns to walk into the room to the tune of “I’m Sexy and I Know It.” Can you blame us though? We watched the fundamental APIs stagnate for so long that a basic feature…
Retrieve Google Analytics Visits and PageViews with PHP
Google Analytics is an outstanding website analytics tool that gives you way more information about your website than you probably need. Better to get more than you want than not enough, right? Anyways I check my website statistics more often than I should and…
CSS Fixed Position Background Image
Backgrounds have become an integral part of creating a web 2.0-esque website since gradients have become all the rage. If you think gradient backgrounds are too cliche, maybe a fixed position background would work for you? It does provide a neat inherent effect by…