Git does not merge all files after resolving conflict

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

So I m not sure if this is a known issue, but lets go through what happened:

    • I create a feature branch off master, and start working on my feature
    • Master is being updated with other features which I don t have in my own feature branch yet.
    • I am done with my feature branch, and I merge in master into my feature branch so that I solve problems before creating a pull-request to master. Also, I checkout master and make sure to git pull from origin to get the latest copy of master.
    • I run git merge master in my feature branch and get merge conflicts.
    I resolve those conflicts and add everything (conflict files and new/modified files) and then commit.
    • I run git merge master again in my feature branch and get Already up-to-date.

Now my problem is that some files are not merged from master. Master clearly has files that have been changed but did not get picked up in my merge. So now when I make my pull-request it is saying I modified certain files that I never touched and attempting to undo changes in master.

Can anyone tell me what I did wrong and how I can fix this issue?

Answers

Your problem is here:

git merge master

What is the problem and how to fix it?

You are merging your local branch which is not up to date with your remote.


How to fix it?

Use git pull origin master instead of just git merge master


What does the previous command does?

When you pull from origin master it "grab" the code from the remote repository rather then from your local master branch.

Another solution can be like this:

# Work on your current branch and commit

# Checkout master branch locally
git checkout master

# now update the local copy with the remote code
git pull origin master

# now switch back to your previous branch
git checkout <branch name>

# merge the updated master to your current branch
git merge master

As you can see the first solution is much more simple and nicer.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/35564107/git-does-not-merge-all-files-after-resolving-conflict

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils