1

I used to pull down jQuery-ui by doing

git clone git://github.com/jquery/jquery-ui/
git 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.

Drew
  • 4,683
  • 4
  • 35
  • 50
  • 1
    http://stackoverflow.com/questions/1304626/git-switch-branch-and-ignore-any-changes-without-committing/1304645#1304645 could help. – VonC Jan 18 '11 at 13:36

2 Answers2

1

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.

Tigraine
  • 23,358
  • 11
  • 65
  • 110
0

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.

Antoine Pelisse
  • 12,871
  • 4
  • 34
  • 34
  • This is a good shortcut and did work even when my git config was messed up. However, that's all I can do. It still wouldn't fix the problem of autocrlf making local changes to files. – Drew Jan 18 '11 at 21:30