Skip to content

Instantly share code, notes, and snippets.

@liuderchi
Last active September 9, 2020 03:45
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 liuderchi/afd186f40a007e436ad80dc0830760ae to your computer and use it in GitHub Desktop.
Save liuderchi/afd186f40a007e436ad80dc0830760ae to your computer and use it in GitHub Desktop.
easy way to keep PR env alive
#!/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