Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#/bin/bash
set -e
# switch to master
git checkout master
# Find all commits added by Gold Fig
commit_ids=$(git log --author=gold-fig --format=%H)
# Check if we're running for real
if [ $1 = "--delete" ]; then
dry_run=false
# Create a backup branch
git checkout -b gold_fig_backup
git checkout master
else
dry_run=true
fi
for commit_id in $commit_ids
do
if [ "$dry_run" = true ]; then
# Just print the commit to delete
echo $(git log $commit_id)
else
# Remove the commit from the log
echo "Deleting ${commit_id}"
git rebase --onto ${commit_id}^ ${commit_id} master
fi
done
if [ "$dry_run" = false ]; then
echo "Use git push origin master --force to remove the gold fig commits from github"
echo "Use git reset --hard gold_fig_backup to restore master to its prior state, with the gold fig commits"
echo "Use git branch -D gold_fig_backup to remove the backup branch"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.