Ignore text=auto in .gitattributes file
I checked out a branch foo
, and now I want to switch to branch bar
.
error: Your local changes to the following files would be overwritten by checkout:
<300 files follow>
Someone has a .gitattributes
file on foo
that includes
text=auto
All of the "changes" are newline changes.
I could remove the file, switch branches, and then add it back.
rm .gitattributes
git checkout bar
git checkout .gitattributes
Is this the best (fastest/least typing) way?
EDIT: To be clear, I just want to switch branches. I'm only reading the repo. I don't want to change anything other than the working tree. But I can't.
I just want to switch branches. I'm only reading the repo.
Then removing the .gitattributes
is indeed one possible solution, provided you don't try to checkout again foo once on bar (or that .gitattributes would appear again)
Another option would be to simply clone the repo directly at the bar
branch, creating a separate working tree.
上一篇: 如何从叉子管理一个孤立的项目?