Peter
Peter

Reputation: 13475

Pull request indicates every file has changed but no changes in each file

My Pull request indicates that I have 7188 changed files, with no actual changes in almost all of these. My actual changes were to around 10 files.

How did I get into this weird git state, and how do I get out?

enter image description here

Upvotes: 0

Views: 1518

Answers (2)

Justin Guerin
Justin Guerin

Reputation: 156

The changes are in file permissions. You don't say whether you checked out the files on Windows or Linux or OS X, nor what client you used, but you should probably set core.filemode to false and clone the project again.

git config core.filemode false

See the core.filemode section of git-config.

Upvotes: 1

eftshift0
eftshift0

Reputation: 30156

Have you set up something like autoctrl? If that's the case, you have probably changed the EOL format of all those files. I will definitely have to write a blog article about this to tell people to not use it... ever.... ever!!!! Use .gitattributes to tell git to not mess up with EOL formats:

* -text

That should do.... In order to correct this revision that you messed up:

# first, make sure that you have setup .gitattributes appropriatetly
git checkout HEAD~1 -- . # got the content back of all the files as they where on the previous revision (don't worry you won't lose your work, because you already committed it, right?).
# set up .gitattributes appropriately _again_ because it was probably cleared by the previous command
# now, get the list of files that actually had something meaningful
git status -w
# the files that are listed there are the files that should have been committed before
# check them out and be ready to change their EOL to what it was on the original revision
git checkout HEAD -- file1 file2 file3
# make sure that the eol format is not busted. If you run git diff HEAD~1 you should only see the real changes that you applied, not the whole files getting cleared and then having full content readded
git add .
# now we amend the revision to how it should have been 
git commit --amend --no-edit
# push -force if required

And you are good to go.

Upvotes: 1

Related Questions