Git Rebase Cheat Sheet/Take ours side for a conflicted file

Resolve one conflicted path using the current branch side.

Section: Rebase Conflicts and Recovery

Take ours side for a conflicted file

bash
bash
git checkout --ours path/to/file && git add path/to/file
Explanation

Useful in conflict resolution when you intentionally want your branch version of a path.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Rebase Conflicts and Recovery
Take theirs side for a conflicted file
Resolve one conflicted path using the incoming side.
OpenIn sheetbashsame section
Check status during rebase
Inspect rebase state and unresolved files.
OpenIn sheetbashsame section
Enable rerere globally
Reuse recorded conflict resolutions in future rebases and merges.
OpenIn sheetbashsame section
Find pre-rebase state in reflog
Locate the branch state before an unwanted rebase.
OpenIn sheetbashsame section
Show current patch during rebase
Inspect the patch currently being replayed.
OpenIn sheetbash3 tag match
Interactive rebase last 3 commits
Edit the last 3 commits.
OpenIn sheetbash2 tag match