Question:
Okay, so I added the file .gitattributes
with lines like this
1 2 3 4 |
*.css text *.js text etc... |
I then followed the instructions at http://git-scm.com/docs/gitattributes#_checking-out_and_checking-in
1 2 3 4 5 6 7 |
$ rm .git/index # Remove the index to force Git to $ git reset # re-scan the working directory $ git status # Show files that will be normalized $ git add -u $ git add .gitattributes $ git commit -m "Introduce end-of-line normalization" |
But now my working copy still has the carriage returns! I have untracked files that I would like to keep. How do I have git checkout the master branch again with the normalized files?
I know the files are normalized in the repository because when I clone the repo, I have all the files without the carriage returns.
Answer:
Ah ah! Checkout the previous commit, then checkout the master.
1 2 3 |
git checkout HEAD^ git checkout -f master |