Last active
March 15, 2024 12:04
-
-
Save justjanne/47d64d05bdaad3322c261761000d85c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
conflicts=$(git status --porcelain | grep UU | cut -d ' ' -f 2) | |
for conflict in $conflicts; do | |
cat $conflict | \ | |
tr '\n' '\r' | \ | |
sed -E 's/<<<<<<< [^\r]*\r((import[^\r]*\r)*)=======\r((import[^\r]*\r)*)>>>>>>> [^\r]*\r/\1\2\3\4/g' | \ | |
tr '\r' '\n' | \ | |
tee $conflict > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment