Created
August 22, 2019 17:56
-
-
Save gsoltis/5ee224c14624a3b8777c75378274451b to your computer and use it in GitHub Desktop.
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 | |
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