how to do git merge

I have two branches : master and branch2.

They only differ on 1 line for a comment:

master has comment : //test 00

branch2 has comment: //test 99

assuming that i start off with branch2 and i merge into master, would that line be 

//test 00 or //test 99 ? when i tried it out it git bash, it returned the message “Merge made by the ‘recursive’ strategy.” but it did not actually show me the changes.

PS C:\Node\projects\n-5-10-workflow-test> git checkout branch2
Switched to branch ‘branch2’
PS C:\Node\projects\n-5-10-workflow-test> git status
On branch branch2
nothing to commit, working tree clean
PS C:\Node\projects\n-5-10-workflow-test> git remote show origin
* remote origin
Fetch URL: https://github.com/masterinex/workflow.git
Push URL: https://github.com/masterinex/workflow.git
HEAD branch: master
Remote branches:
branch2 tracked
master tracked
Local branch configured for ‘git pull’:
master merges with remote master
Local refs configured for ‘git push’:
branch2 pushes to branch2 (fast-forwardable)
master pushes to master (up to date)
PS C:\Node\projects\n-5-10-workflow-test> git status
On branch branch2
nothing to commit, working tree clean
PS C:\Node\projects\n-5-10-workflow-test> git branch -a
* branch2
master
remotes/heroku/master
remotes/origin/branch2
remotes/origin/master
PS C:\Node\projects\n-5-10-workflow-test> git merge master
Merge made by the ‘recursive’ strategy.
PS C:\Node\projects\n-5-10-workflow-test>

A git merge command:

  • Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch.

In other words, if you have master checked out and you run git merge branch2 then the changes you made in branch2 will be added to the master branch. What content you end up with on that specific line depends on what changes you made to that line in master and what changes you made to that line in branch2 since you branched off of (I assume) the master branch.

  • If you made a change to the line in branch2, but did not change that line in master, then that change you made in branch2 will be merged into master and you will see the branch2 version.
  • If you made a change to the line in master, but did not change that line in branch2, then there is no change to that line in branch2 to merge in, so master will keep the change to that line that you made.
  • If you made a change to the line in both master and branch2, then merging in branch2 will create what is known as a “merge conflict”, and you will need to manually pick which version you want to keep.

In other words, you’ll usually get the newest change, which is usually what you want. :)  You can read more about the git merge command here.

If you made a change to the line in both master and branch2, then merging in branch2 will create what is known as a “merge conflict”, and you will need to manually pick which version you want to keep.

I made changes to both master and branch2, how come i did not get a merge conflict with git bash ? how do you resolve conflict with git bash ?