Skip to content

Instantly share code, notes, and snippets.

@mikeNG
Created January 9, 2022 22:45
Show Gist options
  • Save mikeNG/e55ef8e7a1e5cd596a950386503054fd to your computer and use it in GitHub Desktop.
Save mikeNG/e55ef8e7a1e5cd596a950386503054fd to your computer and use it in GitHub Desktop.
#!/bin/sh
case "$2,$3" in
merge,)
if grep -q "# It looks like you may be committing a merge." "$1"; then
sed -i -e '/# ------------------------ >8 ------------------------/,+3d' "$1"
/usr/bin/perl -i.bak -ne 's/^#// if /^# Conflicts/ .. /^#\R/; print' "$1"
sed -i '/ It looks like you may be committing a merge./i # ------------------------ >8 ------------------------' "$1"
fi
;;
*)
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment