jdog
jdog

Reputation: 10759

In Git how do make my current branch master or merge it to master but force it to accept all my changes

I have a project where I created a new branch (i.e. not master, but off master) about 6 months ago. I forgot and now I want to merge the new branch with Master, but I want master to accept all my changes, in from my new branch, with any conflicts.

Master should just take, shut up and accept everything.

Here is my current stat

Master > 6monthBranch > hotfix

I want to end up with

Master6monthBranch > hotfix

Where Master6monthBranch is really Master but with all 6monthBranch merged in (without conflicts).

Is there some command I can run to give you any more helpful information?

Upvotes: 0

Views: 1221

Answers (1)

dyng
dyng

Reputation: 3054

If you want your new branch to be the new master, run

git checkout 6monthBranch
git merge -s ours master

# if you want the merged branch be called master, then
git checkout master
git merge 6monthBranch

the merged branch will be exactly 6monthBranch, actually it just mark the former master branch as a parent of merged branch but do nothing in file level.

Or if there is something you really need which is placed in master but not in 6monthBranch, run

git checkout 6monthBranch
git merge -X ours master

where merge strategy -X ours will automatically resolve all conflict (by preferring contents in 6monthBranch on no condition), and it will not bother you.

Upvotes: 1

Related Questions