Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please document CRLF workaround on our wiki pages #23726

Open
peter-ahe-google opened this issue Jun 26, 2015 · 2 comments
Open

Please document CRLF workaround on our wiki pages #23726

peter-ahe-google opened this issue Jun 26, 2015 · 2 comments
Labels
area-documentation Prefer using 'type-documentation' and a specific area label.

Comments

@peter-ahe-google
Copy link
Contributor

In an email, @herhut-ggl said:

When pulling that change you might end up in a situation where git tells you that you have modified files but git diff does not show any modifications. Even worse, git reset --hard will not get rid of those modifications either.

The reason is that the file only differs in its line endings, which however would be normalized away on commit, so the diff of the commit is empty. Git still considers the file modified though.

To fix this, you have to instruct git to remove the specific file from its cache first and then restore it. The command for this is

git rm --cached

To do this for the entire repo (all your uncommited changes will be lost!) you can do

git rm -r --cached .

Afterwards

git reset --hard

will restore a clean copy with the correct line endings for you.

I think this information belongs on a wikipage.

@peter-ahe-google peter-ahe-google added Triaged area-documentation Prefer using 'type-documentation' and a specific area label. labels Jun 26, 2015
@seaneagan
Copy link

This is what I always reference:

https://help.github.com/articles/dealing-with-line-endings/

@peter-ahe-google
Copy link
Contributor Author

That's pretty nice. What I like about Stephan's version is that it is shorter and more direct. Perhaps a stackoverflow question would be better?

@kevmoo kevmoo removed the triaged label Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-documentation Prefer using 'type-documentation' and a specific area label.
Projects
None yet
Development

No branches or pull requests

3 participants