I have two branches. Staging and Beta. Staging has code in it ( including files ), that I do not want at all. How can I make Beta completely overwrite Staging, so that none of those files or code are merged from Staging into Beta.
I see some people recommend doing this :
git checkout staging git merge -s ours beta
But I don't believe the pre-existing files would be a "code conflict" and therefore would not be removed. Am I wrong? If I'm right, how would I accomplish this?
Just like git push --force allows overwriting remote branches, git fetch --force (or git pull --force ) allows overwriting local branches.
You can use the git reset --merge command. You can also use the git merge --abort command.
Usually git does not overwrite anything during merge.
Force PushingUsing the -f flag, your previous master is completely overwritten with develop , including its history. Warning: this erases all commits from the master branch that are not also in the develop branch.
You can simple delete staging
and re-create it based on beta
:
git branch -D staging git checkout beta git branch staging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With