问题
A file has been changed both locally and remotely.
I would expect to be able to solve the conflicts.
However when I execute a "git pull" with IntellilJ, I get the following message: "Git Pull Failed. Your local changes would be overwritten by merge. Commit, stash or revert them to proceed."
What I need to do to merge the local changes with the remote changes, then commit and push?
回答1:
Do a commit on the stuff you have in your local workspace, then pull.
回答2:
When you have changes that aren't committed to your own repo in any way, git doesn't have any way to know how you would want the pull to affect your files in the current state.
Another way to look at it is that the git client won't let you change files which are modified.
If you wish to discard your local changes, you can revert them. If you wish to commit them to the repo, then just commit. If you wish to keep the changes for later but they aren't going into the repo just now, you can stash them. You can read about these commands in the progit book or any other resource online, if you're not sure what they do. Good luck!
来源:https://stackoverflow.com/questions/28538346/cannot-solve-conflicts-after-git-pull