Git merge command merges current branch to another branches. Depends on which branch is current, the result will be different.
Let’s start with a repository.
Current branch is master. If merge master with dev by running $ git merge dev, the result is below.
Or, if checkout dev as current branch.
Then merge it with master, the result is shown next.
What’s the difference?
- Merging dev with master, dev branch moves forward. Master branch stay where it is.
- Merging master with dev, master branch moves forward. dev branch stay where it is.
That means, current branch moves forward. Target branch stays where it is.