-
-
Save ArnabXD/4d05fb03c2725cab953a6e7cda56f568 to your computer and use it in GitHub Desktop.
Git merge/replace orphan branch into main
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
git checkout --orphan new | |
# completely rewrite your application in new framework | |
git merge --strategy=ours --allow-unrelated-histories main | |
git commit-tree -p HEAD^2 -p HEAD^1 -m "Merge branch 'new'" "HEAD^{tree}" | |
git reset --hard $OUTPUT_FROM_PREVIOUS_COMMAND | |
git checkout main | |
git merge --ff-only new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment