Ahmed Z. Ahmed Z. - 1 month ago 12
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,

Dev
and
Master
. I worked on
Dev
. When I wanted to merge with
Master
, 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
Master
branch but the files that had conflict weren't showing any changes.

They were on
Dev
but not on
Master
.

What did I do wrong?

Answer

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

Comments