fernando1979
fernando1979

Reputation: 1947

Why git doesn't allow pull changes in files with uncommitted changes?

I have read many times that "By default git pull will refuse to perform an update that touches any files with uncommitted modifications". My questions would be

Thanks

Upvotes: 1

Views: 243

Answers (1)

poke
poke

Reputation: 388023

Reason 1 is correct. Git simply cannot know before trying whether it can successfully merge the changes you pull in and your uncommitted changes. In normal merge conflict situations this is not a problem as all versions are stored securely in the local repository, so if there is a problem, it’s easy to fix or revert the whole operation.

When there are uncommitted changes though, Git does not have those changes saved somewhere. So when you pull in some other changes, Git will only properly merge those files that have no local changes.

Upvotes: 1

Related Questions