Last active
August 24, 2021 16:00
-
-
Save KubaO/3fed128f54ec4eee413479aca137d8e1 to your computer and use it in GitHub Desktop.
Remove all replace refs in git
This file contains 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 | |
# This removes all replace refs in the current repo, after logging them. | |
set -e | |
cmd=$(basename "$0") | |
logfile="~/.${cmd}.log.txt" | |
tmpfile=$(mktemp "${TMPDIR}/.${cmd}") | |
origin=$(git config --get remote.origin.url) | |
echo "# $(date) BEGIN ${origin}" >> "${logfile}" | |
git replace -l >> "${tmpfile}" | |
cat "${tmpfile}" >> "${logfile}" | |
echo "# $(date) END" >> "${logfile}" | |
xargs --no-run-if-empty --arg-file="${tmpfile}" --max-args=25 git replace -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment