When I try the git branch
command to see a list of my branches, I can't see any thing. Snapshot:
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!
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
First of all update your local repo with the remote repo
git fetch --all --prune
Now checkout any branch you need
git checkout master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With