如何在git中保存合并后的主文件冲突

use*_*542 5 git version-control version git-checkout merge-conflict-resolution

我多次陷入这种境地

1. I work on master branch and make some commits
2. Then i use git pull
3. Then i get auto merge fail , conflicting changes
Run Code Online (Sandbox Code Playgroud)

现在假设有5个文件存在冲突.我想知道

1. How can i overwrite those conflicting files with my files on my commit
2. How can i overwrite those with chnages from master
Run Code Online (Sandbox Code Playgroud)

在我做git pull之后

Ada*_*ruk 11

您可以使用

git checkout --theirs -- path/to/file.txt
Run Code Online (Sandbox Code Playgroud)

检查你提取的内容

git checkout --ours -- path/to/other/file.txt
Run Code Online (Sandbox Code Playgroud)

检查你原来的东西.

git diff --name-only --diff-filter=U | xargs git checkout --ours -- 
Run Code Online (Sandbox Code Playgroud)

使用所有冲突文件的版本.