7

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!

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
lebowski
  • 1,031
  • 2
  • 20
  • 37
  • http://stackoverflow.com/questions/5989592/git-cannot-checkout-branch-error-pathspec-did-not-match-any-files-kn I think, this might solve your problem!! – lakshman_dev Feb 29 '16 at 08:32
  • if you don't have any local changes you might loose, you can also just delete the whole folder (containing .git/ and all your files) and clone it again from the repository (on server). – Fabio Feb 29 '16 at 09:19

1 Answers1

10

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
Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167