简体   繁体   中英

Merging master into dev/branch will overwrite dev/branch

I am attempting to merge master into my dev/branch, which has a new component X. Once the merge is complete, this component X from dev/branch is removed since it never existed in master.

The only merge conflicts I get seem to be from unrelated files that I never touched during the programming of component X.

What is going on here and how can I fix this and merge in the proper way?

Why do you want to merge master in dev/branch. Shouldn't you merge dev/branch into master? Also, your hypothesis is incorrect.

Once the merge is complete, this component X from dev/branch is removed since it never existed in master.

When you merge master to your dev branch. All the commits that are on master and not on you dev/branch will be added to your dev/branch . And in your case the same is happening. And the unrelated code you are saying is actually on master which will be merged to dev/branch and git probably doesn't know which branch's code it uses to create a merge landing you to the conflict.

I suggest, that you abort the merge using git merge --abort and spend some time to think that do you really want to merge master to dev/branch? What exactly you want to achieve.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM