Skip to content

Instantly share code, notes, and snippets.

@ivanleoncz
Last active July 22, 2020 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanleoncz/c20033e5f4b24304cbc39e0bac1d43e8 to your computer and use it in GitHub Desktop.
Save ivanleoncz/c20033e5f4b24304cbc39e0bac1d43e8 to your computer and use it in GitHub Desktop.
Rollback all files from a commit to another.
#!/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