简体   繁体   中英

git merge master not merging changes/conflicts from master into local branch

I'm trying to merge changes from master(locally) to my feature branch, but I'm not able to. Here's what I've tried

I checked out my remote github branch and now have a local branch that's tracking the changes:

$ git branch -a
* master
  remotes/origin/ABC-1849-add-new-changes
  remotes/origin/master
  ... 
  other remotes
  ...

$ git checkout ABC-1849-add-new-changes
Branch ABC-1849-add-new-changes set up to track remote branch ABC-1849-add-new-changes from origin.
Switched to a new branch 'ABC-1849-add-new-changes'

At this point, if I do a

$ git diff master

I see at least 7 files that have conflicts. I need to merge these changes from master on to my branch. So I do:

$ git merge master

And all I see is:

Auto-merging random_modules.mk
Merge made by the 'recursive' strategy.
random_modules.mk | 1 +
1 file changed, 1 insertion(+)

None of the files with conflicts are showing up. I don't see any message saying there's merge conflict. If I do a diff with master, all the conflicts still show up

A simple git diff master by itself cannot tell you whether there will be merge conflicts. It takes two separate git diff commands, whose output must be scanned carefully, to find out if there will be conflicts.

(Why do you believe, based on a single git diff master , that there are 7 files that have conflicts? If we figure that out, we can probably explain where you have gone wrong here.)

If the differences come from commits on your branch, it is only normal that git keeps these changes, and updates only the changes coming from master.

The diff you may want to look at is :

# if you haven't merged master into my/branch yet :
git diff my/branch...master   # three dots

# if you have already merged master into my/branch :
git diff my/branch^...master

This will show you the diff between "the merge base between my/branch and master ", and master .
This is the diff that git views as : the changes that were committed to master and not to my/branch yet.

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