Skip to content

Instantly share code, notes, and snippets.

@simon04
Created January 14, 2020 07:16
Show Gist options
  • 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
@TarikIbrahim
Copy link

brilliant,it saved my time,thanks.

@Mohammadaasim99
Copy link

brilliant,it saved my time,thanks.

@ezeholz
Copy link

ezeholz commented Jul 21, 2023

brilliant,it saved my time,thanks.

@kolypto
Copy link

kolypto commented Oct 1, 2024

brilliant,it saved my time,thanks.
really, best answer!

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