Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I see any branch in git?

Tags:

git

github

When I try the git branch command to see a list of my branches, I can't see any thing. Snapshot:

enter image description here

As you can see, the commands git branch and git branch -v do not show a list of branches as they are supposed to.

Details: I have been messing around with my repository for some time now. My repo's github webpage says that branch hw3 is 17 commits ahead of master.

Is it because I have deleted everything from branch hw' in my local repo?

Also, when I try the command git checkout master, I get the following message:

error: pathspec 'master' did not match any file(s) known to git

As of now, I have deleted everything in the hw' branch on my machine, but the Github webpage still shows all those files.

Also, I typed in the command git init while in the hw3 branch as a suggestion from another question on stackoverflow. How will this affect me?

Initially, I had a bunch of files in my hw3 branch and just a README file in my master branch. I just want things to get back to normal.

How should I proceed? Thanks!

like image 999
lebowski Avatar asked Feb 29 '16 08:02

lebowski


1 Answers

git branch without any parameters only print out the local branches.

git branch common options:

# print out local branches
git branch   

# print out remote branches
git branch -r

# print out local & remote branches
git branch -a

How to resolve your problem

First of all update your local repo with the remote repo

git fetch --all --prune
 

Now checkout any branch you need

git checkout master
like image 76
CodeWizard Avatar answered Sep 20 '22 22:09

CodeWizard