I have a very out of date master
branch in a git repository.
All of my work has been done in another branch.
What is the best way to merge the
A complete overwrite isn't merging the other content, it's abandoning it.
git checkout -B master anotherbranch
This has the advantage over a delete-and-recreate of retaining your branch settings and reflogs.
If there's some administrative requirement to retain worthless commits in your history, follow that with git merge -s ours master@{1}
. I prefer this sequence because it generates an unusual merge message, which will alert scanning --oneline
logs that the merge is unusual.