How do you git fetch then merge? “Error: Your local changes to the following files would be overwritten by merge”

痞子三分冷 提交于 2019-11-26 19:44:25

问题


Newbie Git question: I have a repo set up on bitbucket. I git fetched someone else's changes and would like to merge them with my own. However, when I try to git merge (or git merge origin/master), I get the message "error: Your local changes to the following files would be overwritten by merge:", and then a list of files I've changed. Having Git merge these changes is exactly what I want to do though.


回答1:


You can either commit your changes before you do the merge, or you stash them:

git stash
git merge origin/master
git stash pop



回答2:


If you want to keep your changes, you can commit your changes to your local repository first and then merge the remote repository.



来源:https://stackoverflow.com/questions/9588111/how-do-you-git-fetch-then-merge-error-your-local-changes-to-the-following-fil

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