Last active
August 29, 2015 13:57
-
-
Save schnell18/9619727 to your computer and use it in GitHub Desktop.
Automate git rebase -i to remove selected commits
This file contains hidden or 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
# Perl onliner is used to delete selected commits from the git rebase -i commit text | |
# The range of commits includes extra commit to prevent git from doing noop when | |
# all commits after certain point are to be backed out. | |
# Some notes on the Perl onliner: | |
# -n: run the script as specified by -e in the while(<>) loop | |
# -i: modify the file inplace | |
# -e: command to run | |
env GIT_SEQUENCE_EDITOR="perl -ni -e 'print unless /^pick (7d105ae|08fe503|97bf990)/'" git rebase -i <earliest_commit_to_backout>^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment