News for hackers. Stuff that matters.
Re:Git koans by stevelosh on Monday April 08, 2013 @12:34PM (#5512731)
If your solution to "get the current branch" is "cat out this magic data file that happens to exist in the data directory" then we have completely incompatible definitions of "user interface" and are never going to agree on this.
Re:Git koans by wonderzombie on Monday April 08, 2013 @12:54PM (#5512866)
The question was not how to just get the current branch, thought, right? As pointed out already, `git branch` does that.

The question was how to do it programmatically, and there are multiple ways to do it. You might still call that user interface, but it's that's a stretch; fancy shell magic like branch-in-prompt is typically write-once.

Re:Git koans by Anderkent on Monday April 08, 2013 @04:49PM (#5514492)
`git branch` doesnt do that. `git branch | less` followed by search might, if I remember some part of the branch name well enough to search for it.

Printing all the branches and having me scroll two screens up to find the one that's in color is not a solution to 'what branch am i on'

Re:Git koans by fr0sty on Tuesday April 09, 2013 @10:10AM (#5518106)
git branch gives you a nice asterisk too: $git branch * MyBranch NotMyBranch

It prints the branch as the first line of git status: $git status # On branch Foo ...

It also ships with a 'bash-competion' file which gives you a very simple way to disply the current branch (among other things) rather simply.

And of course you can also create your own alias if it is something you wish to do often.

Re:Git koans by philwelch on Tuesday April 09, 2013 @12:08PM (#5519061)
Why are you keeping hundreds of branches open at a time?
Re:Git koans by kyrias on Monday April 08, 2013 @04:13PM (#5514229)
If you want the branch in your prompt you should use the script that is shipped with git.