Checking out specific branch from github
I used to pull down jQuery-ui by doing
git clone git://github.com/jquery/jquery-ui/
g开发者_如何学运维it checkout 1.8.6
This stopped working today. After I do a git clone on an empty repository, the checkout fails with:
error: You have local changes to 'demos/spinner/currency.html'; cannot switch branches.
Any recommendations on how to fix this? I don't want to pull zips of 1.8.6, I want the ease of being able to switch between old and new branches of jQuery UI for testing.
You have local modifications in your working copy. Thus you can't switch.
Either commit those changes using git commit
or reset them using git reset --hard
Since you are getting this on git clone I suspect this may be related to your core.autocrlf setting.
Try running git diff
- If you see all lines in the file being marked as changed git is converting the line endings upon checkout.
You can fix this by running
git config --global core.autocrlf false
Retry the clone/checkout after setting core.autocrlf to false. This should have fixed the issue
Hope this helps.
By the way, you can do:
git clone git://github.com/jquery/jquery-ui/ -b 1.8.6
which would answer the question in the title.
精彩评论