Here's the sequence of commands I had run:
Here, I'm on master.
$ git branch
* master
Creating a file on the master branch, and committing it.
$ echo "hello world, from master." > helloworld.sh
$ git add helloworld.sh
warning: LF will be replaced by CRLF in helloworld.sh.
The file will have its original line endings in your working directory.
$ git commit -m "Adding helloworld.sh"
[master e15289b] Adding helloworld.sh
warning: LF will be replaced by CRLF in helloworld.sh.
The file will have its original line endings in your working directory.
 1 file changed, 1 insertion(+)
 create mode 100644 helloworld.sh
$ git status
On branch master
nothing to commit, working directory clean
Creating a new branch called firstbranch.
$ git branch firstbranch
$ git checkout firstbranch
Switched to branch 'firstbranch'
$ ls
helloworld.sh
Adding some code to helloworld.sh:
$ echo "hello world, from firstbranch" >> helloworld.sh
$ cat helloworld.sh
hello world, from master.
hello world, from firstbranch
Switch back to master:
$ git checkout master
M       helloworld.sh
Switched to branch 'master'
Check the contents of helloworld.sh on the master branch:
$ cat helloworld.sh
hello world, from master.
hello world, from firstbranch
This totally surprised me! I thought the changes in firstbranch will not be reflected here until I do a merge. I've not even committed my changes in firstbranch, but it still appears in master branch. What's going on here?