To resolve merge conflicts with master so that your changes override the conflicting changes from master, follow these steps:

1. Fetch and merge master

1
2
git fetch origin
git merge origin/master

If there are conflicts, Git will pause and mark the conflicting files.

What is the difference between git fetch and git pull?:

git fetch downloads objects/refs from another repository (or remote) but doesn't merge them into your working directory. git pull does both: it fetches and then merges.


2. Overwrite conflicts with your version

For each conflicted file:

1
git checkout --ours <file>

--ours = your branch (i.e., your changes override master)

Repeat this for all conflicted files or run:

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

3. Mark conflicts resolved

1
git add .

4. Complete the merge

1
git commit

Alternative: Rebase with your changes overriding master

1
git rebase origin/master

Then during each conflict:

1
2
3
git checkout --ours <file>
git add <file>
git rebase --continue

Warning: This strategy discards all changes made in master for the conflicted files, so use it only when you're sure your changes must prevail.