简体   繁体   中英

Git merge release branch into master conflicts

I know this answer might have been answered a million times before but each situation is different and I want to know what I'm doing wrong in my case. I'm very new to git so would appreciate an explanation.

I have a commit history like this: (Using SourceTree)

源代码树的屏幕截图

Currently all changes are being done locally. The blue line is develop branch, a release branch was previously created (Yellow) and later merged into master (pink) and that was all fine.

Then develop branch advanced with more commits. Now today I created another branch from develop called release-ecomm which was on second to last commit. Then I added another commit to release-ecomm . Now I'm trying to merge this release branch into master . I checked out master and hit merge and selected the latest commit, but it failed.

合并冲突

The files listed here include both edited and non edited files. Style.css and Script.js were edited but other files were not touched at all since the last commit to master. Then the tree structure changes like so with conflicting files:

修改树图

What I would like is the master version to incorporate the changes made to the few files that are modified in release-ecomm . What am I doing wrong?

You branched release-ecomm from develop, so all changes from develop until that point are also included in the merge.

If you only want the changes from a single commit to master, use git cherry-pick :

git checkout master
git cherry-pick <commit hash>

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