Skip to content

Instantly share code, notes, and snippets.

@brunnogomes
Created July 6, 2018 22:28
Show Gist options
  • Save brunnogomes/47655eb4a5360e3906b2a2dba2bfff6d to your computer and use it in GitHub Desktop.
Save brunnogomes/47655eb4a5360e3906b2a2dba2bfff6d to your computer and use it in GitHub Desktop.
Promote alternate git branch to master branch
# We actually don't need to do that.
# Even if the branches are very different and you don't wanto resolve a ton of conflicts.
# Using the strategy argument in the merge command, you can instruct git to just use
# tha state in the current branch and do the merge, preserving all the history.
git checkout alternate_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge alternate_branch # fast-forward master up to the merge
# Now you can delete the alternate_branch and go back to using master.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment