git 删除git中的文件冲突

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7337434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:58:09  来源:igfitidea点击:

Remove file conflicts in git

gitconflict

提问by Firdous

I committed my code and when I do a git pullI found some conflicts. How do I solve the conflicts and only get the file version from pulling without my committed changes?

我提交了我的代码,当我做一个时,git pull我发现了一些冲突。如何解决冲突并仅在没有提交更改的情况下从拉取文件中获取文件版本?

回答by Kit Ho

you can do

你可以做

git reset --hard HEAD^

git pull

Unstage all of your changes and do a fast-forward merge. There is no need to solve the conflict anymore.

取消所有更改并进行快进合并。没有必要再解决冲突了。

回答by Kevek

You can hard reset your branch to the commit before your changes, and then cherry pick each of the subsequent commits. This will bring your branch to a state that includes everything except for your changes.

您可以在更改之前将分支硬重置为提交,然后挑选每个后续提交。这将使您的分支进入包含除更改之外的所有内容的状态。