Yes, you can discard your local changes entirely and keep only the remote version to avoid fixing conflicts manually.
There are a few ways to do this depending on your situation. Here’s the cleanest and safest method:
🔥 Option 1: Replace Local with Remote (Start Fresh)
If you're okay removing all local changes and using only the remote version, do this:
Stash or backup current work if needed
git fetch origin
git reset --hard origin/<branch-name>
Replace <branch-name> with your target branch (e.g., main).
This will:
Discard all local commits and changes
Set your local branch to match the remote exactly
🧼 Option 2: During Merge, Prefer Remote Files
If you're in the middle of a merge and want Git to prefer remote (incoming) changes for all conflicts, you can run:
This tells Git to use incoming changes for all files
git checkout --theirs .
git add .
git commit
This:
Keeps the remote version of every conflicted file
Completes the merge with a commit
⚠️ Warning
Both options erase local changes. Be sure you don't need anything locally before doing this — or back it up