Last active
January 12, 2021 14:42
-
-
Save tbnorth/bdd95d1c104c69c788fac3879a7848d4 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
| # rebase "BRANCH" onto "MAIN", change these as needed | |
| MAIN=main | |
| BRANCH=tmp/docs | |
| # should be no changed files before you start | |
| [ -z "$(git status --porcelain --untracked-files=no)" ] || echo "Changed files in repo." | |
| git checkout "$MAIN" | |
| git pull | |
| git checkout "$BRANCH" # before diff in case no local branch $BRANCH | |
| git diff "$MAIN..$BRANCH" # just to inspect | |
| git rebase --interactive "$MAIN" # choose actions for each commit | |
| git checkout "$MAIN" | |
| git merge "$BRANCH" | |
| git diff "$BRANCH..$MAIN" # should be no diffs | |
| git push | |
| # delete remote branch first, if it was ever pushed at all | |
| git push -d origin "$BRANCH" | |
| # to avoid "not fully merged" when deleting local | |
| git branch -d "$BRANCH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment