Git rebase merge auto-accept changes

NOTE: using git rebase in general can wipe out a lot of work in difficult or impossible to recover ways. Before doing operations like this, create a copy of the Git branch and push it so that you can recover from undesired outcomes.


Git rebase or merge operations on a feature branch with numerous commits can be fatiguing when it’s known that all of either the local or remote changes should be accepted in conflicts. This auto-accept of changes can be done on some or all changed files.

Git rebase auto-accept operations have the reverse sense of merge.

Rebase on “main”, auto-accept all local changes in conflicts:

git rebase -X theirs main

Rebase on “main”, auto-accept all remote changes in conflicts:

git rebase -X ours main

Git merge auto-accept operations have the reverse sense of rebase.

Merge “main”, auto-accept all local changes in conflicts:

git merge -X ours main

Merge “main”, auto-accept all remote changes in conflicts:

git merge -X theirs main

Reference