How to overwrite a certain branch with master
I have two branches
master. I want my dev branch to be completely overwritten by
master branch as I know master is latest. How can I do that using TortoiseGit UI?
I tried to do merge using TortoiseGit but that would result in many conflicts.
Please let me know the answers in Tortoise GIT only as I am only using UI and not familiar with actual GIT commands.
3 Solutions collect form web for “How to overwrite a certain branch with master”
If you want all changes from
git checkout dev_branch git reset --hard master
This only works if other people haven’t cloned the repository.
You can also rename the dev branch to something old and then make a new branch from master with the same name:
git branch -m dev_branch old_dev_branch git branch -m master dev_branch
Or, use the ours strategy — not sure why it wouldn’t work for you:
git checkout master
git merge -s ours dev_branch
git checkout dev_branch
git merge master
Not sure much, but i hope the below link will surely help you out as per your intention.
In TortoiseGit you have several options depending on your scenario:
You are on the
devbranch: Go to the log dialog, open the context menu on the master branch entry and select “Reset to” and choose “hard”.
You are not on the
devbranch: Create a new branch with the name
masterbranch as origin and select “Override branch if exists” (or go to the log dialog, open the context menu on the dev branch and select delete branch and open the context menu on the
masterbranch and create a new branch called
I have no idea if this is right or wrong, but I seem to have overwritten another branch with master like this:
git push origin master:otherbranch
And then when I switched I had to pull, and it was good to go?