Reputation: 1947
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
The working directory gets filled with the content of the working local branch, right?
Git doesn't allow to pull changes in files with uncommitted local modifications because reason 1 or 2:
Thanks
Upvotes: 1
Views: 243
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