Roman Roman - 3 months ago 30
Git Question

Why can't I see what branch I am in?

I have just created a brand-new git repository:

git init

Now I want to see what branch I am in. So, I execute:

git branch

This command does not output anything (my expectation was that I will see only one branch "master" and I will be in there).

So, I guess there are no branches at all. So, I try to create a branch by:

git checkout -b aaa

As a result I see:

Switched to a new branch 'aaa'

But when I execute

git branch

I get no output again. So, how can I verify that I am in a particular branch?

Answer Source

You could do a git status.

The first line will be: On branch aaa.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download