Bash script github pages rollback
#!/usr/bin/env bash
echo "Insert commit hash" read commitHash
branch=$(git branch --show-current)
branchpatch=patch
if [ -z "$commitHash" ]; then
echo "No commit hash supplied"
exit
fi
git checkout $branch
git reset --hard $commitHash
git checkout -b $branchpatch
git add -A
git commit -am "hotfix patch ${branch}@${commitHash}" 2> /dev/null
git checkout $branch
git checkout $branchpatch .
git add -A
git commit -am "hotfix patch ${branch}@${commitHash}" 2> /dev/null
git push origin $branch
git branch -D $branchpatch
Usage to rollback
sh filename.sh
- input your
commit
hash to rollback
- wait until finished
Created at 2023-02-28 01:47:15
Updated at 2023-09-02 21:28:04
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.