Cannot solve conflicts after git pull

南楼画角 提交于 2021-02-08 08:12:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!