Skip to content

Instantly share code, notes, and snippets.

@yangsu
Created October 16, 2013 18:22
Show Gist options
  • Save yangsu/7012406 to your computer and use it in GitHub Desktop.
Save yangsu/7012406 to your computer and use it in GitHub Desktop.
Force merge git merge conflicts taking master's changes
#!/usr/bin/env bash
for f in $(git status -s | grep "UU\|AA" | sed -E 's/(UU|AA) //'); do
echo $f
TEMP="$f.tmp"
cat $f | sed '/>>>>>>>/d' | sed '/<<<<<<</,/=======/d' > $TEMP
rm $f
mv $TEMP $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment