Can't pull or push after git clone - local changes
开发者_如何学CI created a new directory c:\Src, where I've cloned a repository. After cloning I get the following
$ git branch
* Search
$ git branch -a
* Search
remotes/origin/master
remotes/origin/prototype
If i then try
$ git checkout -b master origin/master
it returns
error: You have local changes to '<some_file>'; cannot switch branches
pull gives the same error.
I have not made any changes, and I'm confused why it doesn't use the master branch as default?
Firstly, you might want to checkout a tracking branch for master. You can use -t or -track instead of the -b (or if you have a recent version of git you can just use git checkout origin/master and it will automatically create a tracking branch).
As for your specific error, you should run git status to see if you have any local changes. If you do, you can then run git stash, do your checkout/pull and then git stash pop afterwards.
加载中,请稍侯......
精彩评论