Joined July 2011
·
Achievements
79 Karma
0 Total ProTip Views
Python
Would you expect anything less? Have at least one original repo where Python is the dominant language
Altruist
Increase developer well-being by sharing at least 20 open source projects
Mongoose
Have at least one original repo where Ruby is the dominant language
Forked
Have a project valued enough to be forked by someone else
Velociraptor
Have at least one original repo where Perl is the dominant language
Velociraptor 3
Have at least three original repos where Perl is the dominant language
Walrus
The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos
Charity
Fork and commit to someone's open source project in need
@haliphax, 'git branch' is human facing ("porcelain") rather than "plumbing". You don't want to rely on parsing git branch output, as it can change. Instead use something like
git symbolic-ref -q HEAD
.symbolic-ref includes the refs/heads prefix, so we can strip that off. Also, it'll complain if you aren't in a git managed directory. So, toss the error to /dev/null, then do a variable pattern substitution, and poof: branch name:
git 1.7.10 added a --short option, that removes refs/heads. Similarly git rev-parse solution:
zsh shell has a lovely system 'vcs-info' for adding repository information to the prompt, works across multiple source control systems, not just git. Example: http://arjanvandergaag.nl/blog/customize-zsh-prompt-with-vcs-info.html
references: http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch