Last active
July 22, 2020 00:17
-
-
Save ivanleoncz/c20033e5f4b24304cbc39e0bac1d43e8 to your computer and use it in GitHub Desktop.
Rollback all files from a commit to another.
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 | |
COMMIT="d92b4247d671bc55723747a00314344a46e848e1" | |
COMMIT_ROLLBACK="807a95993b80db239bd1c24d3fbeb4bb265430be" | |
echo "[INFO]: listing files from commit $COMMIT and rolling back to $COMMIT_ROLLBACK, in 5 seconds" | |
sleep 5 | |
for file in `git show --pretty="" --name-only $COMMIT` ; do | |
echo " * $file" | |
git checkout $COMMIT_ROLLBACK $file | |
done | |
git commit --amend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment