Skip to content

Instantly share code, notes, and snippets.

@alexbevi
Created July 29, 2011 13:10
Show Gist options
  • Save alexbevi/1113777 to your computer and use it in GitHub Desktop.
Save alexbevi/1113777 to your computer and use it in GitHub Desktop.
git filter-branch to rewrite asylum history to prepend "ASYLUM: " to all entries that need it
git filter-branch -f --msg-filter '
i=0
while read line
do
if [ $i -eq 0 ];
then
if expr "$line" : ".*ASYLUM:.*" > /dev/null;
then
echo "$line"
else
echo "$line" | sed "s/^/ASYLUM: /g"
fi
else
echo "$line"
fi
i=1
done ' f5b266b~1..HEAD
@alexbevi
Copy link
Author

// how to remove myself as the committer
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "Alex Bevilacqua" ];
then
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME";
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL";
git commit-tree "$@";
else
git commit-tree "$@";
fi' f5b266b~..HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment