Question

I fall in to this situation many times

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

Now suppose there were 5 files which were conflicting. I want to know

1. How can i overwrite those conflicting files with my files on my commit
2. How can i overwrite those with chnages from master

after i do git pull

Était-ce utile?

La solution

You can use

git checkout --theirs -- path/to/file.txt

to checkout what you fetched

git checkout --ours -- path/to/other/file.txt

to checkout what you had originally.

git diff --name-only --diff-filter=U | xargs git checkout --ours -- 

to use your version of all conflicted files.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top