Satria Janaka
Satria Janaka

Reputation: 481

Why git status said I'm on master branch, but git branch shows nothing?

I'm currently studying about basic concept of git, and creating a local git repository on my machine. And I just curious, why when I use git branch shows nothing but when I use git status, git said that I'm on branch master?. I'm expecting when I run git branch, there is master branch displayed

What I did are :

mkdir my-app
cd my-app
touch README.md
git init
git config user.email "my_email"
git config user.name "my_name"
git checkout -b master
git add .
git commit -m "initial commit"
git branch

Here's some screenshoot :

enter image description here enter image description here enter image description here enter image description here

Upvotes: 0

Views: 181

Answers (2)

matt
matt

Reputation: 534925

I'm going to guess that the output of git branch is

* master

...but that you cannot see the word master because something is wrong with the color display settings in the Terminal / shell you're using.

Upvotes: 3

mtm
mtm

Reputation: 512

git branch is used to list, create, or delete branches whereas git status is used to show the working tree status.

You can refer the git reference here for details regarding git commands.

Upvotes: 0

Related Questions