I have a project where I created a new branch (ie 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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.