Git branch returns no results

I'm trying to see which branch I'm working on, but not working ...

$ git checkout -b test Switched to a new branch 'test' $ git branch $ git branch -a $ 
+6
source share
1 answer

This is because you haven’t done anything yet, when you do git checkout -b test , git changes the contents of the .git/HEAD file from ref: refs/heads/master to ref: refs/heads/test , which actually does not indicate anything . Only after you commit, git create test refs for you, and you find the .git/refs/heads/test file containing the hash of the commit just made.

+9
source

All Articles