I'm trying to automate a process and issue the git branch
command to find out what branch I am on. Everything is working fine except for a newly initialized repo where git branch
returns nothing. Given I've done nothing with the repo, not even the initial commit, I can accept the answer. However, if I run a git status
it tells me I'm on the master
branch, as seen here:
$ mkdir todelete
$ cd todelete
$ git init
Initialized empty Git repository in /u/u70021a/todelete/.git
$ git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
$ git branch
$
Am I doing something wrong? Is there some setting I haven't set properly?
I also have a number of new people to Git and I can't explain to them why the command to show which branch they are on shows nothing, yet the status command does.