Skip to content

Instantly share code, notes, and snippets.

@simon04
Created January 14, 2020 07:16
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save simon04/08197014b96db7b3108db2370db82497 to your computer and use it in GitHub Desktop.
Save simon04/08197014b96db7b3108db2370db82497 to your computer and use it in GitHub Desktop.
Git merge/replace orphan branch into master
git checkout --orphan new-framework
# completely rewrite your application in new framework
git merge --strategy=ours --allow-unrelated-histories master
git commit-tree -p HEAD^2 -p HEAD^1 -m "Merge branch 'new-framework'" "HEAD^{tree}"
git reset --hard $OUTPUT_FROM_PREVIOUS_COMMAND
git checkout master
git merge --ff-only new-framework
@Mohammadaasim99
Copy link

brilliant,it saved my time,thanks.

@ezeholz
Copy link

ezeholz commented Jul 21, 2023

brilliant,it saved my time,thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment