Arman
Arman

Reputation: 1442

git pull origin master marks changes from master as modified in my feature branch

To update my feature branch with the latest changes from master, I used git pull origin master.

I then received a message that says there are conflicts which I need to resolve first. I manually resolved those conflicts, but when I tried to run git status, I expect git to show only the files that I modified as a result of resolving the conflicts. The problem is that the changes from master that were not in my feature branch are marked as 'modified' as well.

How do I pull changes from master such that git will only recognize the files that I really modified and not those that just came from master? I've been using git in a multi user environment just for a while now, and know that my previous git pulls doesn't recognize changes in master. Or maybe is it because of the conflict? If so how do I tell git to just merge those changes without marking them as modified?

Upvotes: 1

Views: 575

Answers (2)

Pradipta Sarma
Pradipta Sarma

Reputation: 1348

This is correct and is how it is supposed to behave. When you take a pull, a new commit happens into your feature branch which you enter a commit message for.

When you take a pull and face conflicts, you are supposed to resolve the conflicts. Remember that the commit that has to happen on a pull (merge) has not happened yet. These will show up as files changed and you've got to add them and make a commit, which essentially is equivalent to the commit that would have occurred in case of a pull with no conflicts.

Upvotes: 1

Akash prajapati
Akash prajapati

Reputation: 474

If you pull from the master branch then all the changes are not in the feature branch so they will show you when you merged. So when you merged and conflict occurs and after you resolved and run the git status then you have find out the two sections

  1. Changes to be committed:
  2. Unmerged paths:

After you resolved the conflict you need to add those files using git add and make commit and push the feature branch so now you successfully merged the master branch into the feature branch.

Upvotes: 0

Related Questions