Created
September 28, 2018 23:15
-
-
Save ad-m/e6816e06f1d2c588d35f27f08b45688c to your computer and use it in GitHub Desktop.
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
| function git_push_delayed(){ | |
| TMP_BRANCH=$(date +"tmp-%s"); | |
| CUR_BRANCH=$(git rev-parse --abbrev-ref HEAD); | |
| git checkout -b "$TMP_BRANCH" "$CUR_BRANCH"; | |
| git branch -D "$CUR_BRANCH"; | |
| git checkout -b "$CUR_BRANCH" "origin/master"; | |
| git log "$TMP_BRANCH"...origin/master --format="oneline" --reverse | awk '{print $1}' | while read COMMIT_ID; do | |
| git merge "$COMMIT_ID"; | |
| git push origin "$CUR_BRANCH" --force; | |
| done; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment