Ahmed Z. Ahmed Z. - 1 year ago 156
Git Question

Git Merge and Missing changes

I'm a bit new to GitHub. Sorry in advance if this is a noob question.
I have 2 branches,

. I worked on
. When I wanted to merge with
, I did the following:

$ git checkout master
$ git pull origin master
$ git merge dev

then i had a few conflicts. I fixed the conflicts using Sourcetree.

Then when I committed the new changes, using:

$ git commit -m "Dev merged in Master"

the files that were not conflicted were showing in
branch but the files that had conflict weren't showing any changes.

They were on
but not on

What did I do wrong?

Answer Source

I do not have enough reputation to add a comment, so apologies for writing this as an answer.

as @Jérémy Giuseppi mentions, you must always add files after any modifications if you wish to include them in your commit. When you resolved the conflict, you made modifications to files B but use of git commit -m 'message' did not include those updates.

To avoid this in the future, I suggest using git commit -a -m 'message', where the -a flag tells git to add all modified files since last commit to the new commit message.

Checkout How to resolve merge conflicts in Git? to see a workflow of resolving conflicts in git

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download