Ahmed Z.
Ahmed Z.

Reputation: 2337

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?

Upvotes: 3

Views: 2580

Answers (2)

sudo_coffee
sudo_coffee

Reputation: 968

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

Upvotes: 1

Did you mark your files as resolved ?

In CLI, when the conflicts are solved : git add yourFile to stage this file before you end the merge.

Upvotes: 3

Related Questions