Reputation: 6121
I have two branches master (which is very old) and new.
What I want to achieve is basically to make new branch to be master.
I tried to merge, but without success. The result of the merge was still not master branch became identical to new branch.
I tried to rebase, but also without success, it was telling me, that I have some deleted files and couldn't rebase. In the end I deleted all deleted files from tracking, but still the result of rebasing was somehow wrong.
Upvotes: 1
Views: 271
Reputation: 124646
It sounds like you just want to rename the branches:
git branch -m master old # rename master to old
git branch -m new master # rename new to master
After this, if you want to clean up the remote too, accordingly:
git push origin old # backup of the old master
git push origin master -f # need to force, history changed
git push origin :new # delete "new", which is now master
Upvotes: 1
Reputation: 5654
I would recommend performing a merge using the "ours" strategy. Doing this will allow you to pull in the history of master, while effectively disregarded everything else. The end result is that the new master, will look exactly what your current branch looks like.
A step by step would look something like:
git checkout goodBranch
git merge master -s ours
git checkout master
git merge goodBranch
Upvotes: 1