Firstly, I would try just merging it to master
and seeing if there really are lots of conflicts - git's merging is great at only marking genuine conflicts. If you make sure that your git status
is clean before you start, and you find that there are too many conflicts to deal with, you can just go back with:
git reset --merge
However, if you just want to make your current master
the same as your other branch, you could do that with:
git checkout master
git reset --hard other-branch
However, that's generally a bad idea since:
- You're throwing away all the work on your master branch. Perhaps you might want that history later? (You could always "back up" your master branch with
git branch old-master master
beforehand.)
- You're rewriting the history of the
master
branch, so if you've ever shared this branch with anyone the results will be confusing for both of you.
git reset --hard
should always be used with caution, since it will throw away all uncommitted changes you have.