5

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

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
user191542
  • 275
  • 1
  • 7
  • 17

1 Answers1

13

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.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141