Last active
November 5, 2021 09:06
-
-
Save olitreadwell/ab7630f6b9fad3746547a83efe74ca51 to your computer and use it in GitHub Desktop.
new-branch-and-auto-commit
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/zsh | |
git reset | |
mkdir -p ~/code/tmp/delete-me/ | |
secondsInterval=20 | |
branchName=`date +"%Y%m%d%H%M%S%Z"` | |
commitDateTime=`date +"%Y-%m-%d %T%Z"` | |
(git ls-files --modified --others --exclude-standard | grep . > /dev/null) && git add . && git stash | |
git checkout main && git pull | |
git checkout -b $branchName && git push | |
git branch --set-upstream-to=origin/$branchName $branchName | |
git stash pop | |
watch -n $secondsInterval ": > ~/code/tmp/delete-me/.${branchName}.txt ; echo "$(date +"%Y-%m-%d %T%Z")" > ~/code/tmp/delete-me/.${branchName}.txt; git pull && (git ls-files --modified --others --exclude-standard | grep . > /dev/null) && { git add . ; git commit -F ~/code/tmp/delete-me/.${branchName}.txt ; git push; }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment