문제

Can somebody tell me how to get back to my main Git root directory? My command prompt was pointing to

c:/Sites 

but now, the command prompt is pointing to:

c/Sites (new_branch)

Not sure how I got there but I suspect that I must have accidentally created a new branch. I tried "git branch" but returned no results. Also tried "git checkout master" but got an error: "pathspec master did not match any file(s) known to git."

I'm on windows 7. Thanks!

도움이 되었습니까?

해결책

Since, you do not see anything with ls -l .git/refs/heads , it implies that you no longer have master branch (may be you deleted your master branch unknowingly as you said above you weren't sure when you accidentally created your branch.

To go back to your original master branch, check your git log for when you created the new branch. once you obtain the commit sha , recreate you master branch with "git checkout -b master ". This will take you to your default prompt.

다른 팁

This means that your directory is now tracked by Git. Since you have that error try to do:

git checkout new_branch

Alternatevely

git checkout -b master

You should be able to do

git checkout master

to go back to master..

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top