I'm from a Subversion background and, when I had a branch, I knew what I was working on with "These working files point to this branch".
But with Git I'm not sure when I am editing a file in NetBeans or Notepad++, whether it's tied to the master or another branch.
There's no problem with git
in bash, it tells me what I'm doing.
I recommend using any of these two commands.
git branch | grep -e "^*" | cut -d' ' -f 2
OR
git status | sed -n 1p | cut -d' ' -f 3
OR (more verbose)
git status -uno -bs| cut -d'#' -f 3 | cut -d . -f 1| sed -e 's/^[ \t]//1'| sed -n 1p
I use this in scripts that need the current branch name. It will show you the current short symbolic reference to HEAD, which will be your current branch name.
One more alternative:
A less noisy version for git status would do the trick
It prints out
In Netbeans, ensure that versioning annotations are enabled (View -> Show Versioning Labels). You can then see the branch name next to project name.
http://netbeans.org/bugzilla/show_bug.cgi?id=213582
should show all the local branches of your repo. The starred branch is your current branch.
If you want to retrieve only the name of the branch you are on, you can do: