Suppose we start with a brand new setup.
touch somefile
git init .
git add .
git commit -m "initial commit"
git branch dev
git checkout dev
After doing git status, I get
nothing to commit (working directory clean)
After doing git merge master, I get
Already up-to-date.
Why is that? I thought new branch starts clean (and empty) until we either add content directly or merge from existing branch.
Branches in Git are nothing more than pointers to commits. When you create a branch as you did, it is pointing to the same commit as the other branch. Once you commit something after that is when you will see them differ. Most other version control systems don’t work on snapshot-based approaches like this.
Thus, when you issue the merge command, it has nothing to merge as your current branch already contains all the commits of the other branch.
I would highly recommend reading progit.org/book and fully understanding the DAG (directed acyclic graph) that the history structure follows.
Hope this helps.