Skip to content

Instantly share code, notes, and snippets.

@joekrump
Last active March 8, 2024 17:31
Show Gist options
  • Save joekrump/68e597cca464701b4907fe360a1e7876 to your computer and use it in GitHub Desktop.
Save joekrump/68e597cca464701b4907fe360a1e7876 to your computer and use it in GitHub Desktop.
Quick resolve multiple files with conflicts when you know if you want "ours" or "theirs" for the resolution
# Helpful for when running git rebase -i and selecting multiple files to fixup or drop
# select ours for each conflict
git status | grep both | awk '{print $3}' | xargs git checkout --ours
# select theirs for each conflict
git status | grep both | awk '{print $3}' | xargs git checkout --theirs
# run with && git add . && git rebase --continue to add and move on
git status | grep both | awk '{print $3}' | xargs git checkout --ours && git add . && git rebase --continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment