Last active
September 9, 2020 03:45
-
-
Save liuderchi/afd186f40a007e436ad80dc0830760ae to your computer and use it in GitHub Desktop.
easy way to keep PR env alive
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
#!/bin/sh | |
# enable this if you want it fail early | |
# set -e | |
# pros: easy and cheap | |
# cons: you have to keep current working directory with unchanged branch (workaround: copy the repo) | |
gcurrentbranch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
while true; do \ | |
git fetch origin; # assume your target remote is origin | |
git reset origin/$(gcurrentbranch) --hard; | |
git commit -a --amend --no-edit --no-signoff && git push --force-with-lease --no-verify && echo ✅ $(date); | |
sleep 1500; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment