I am relatively new to using Git. This is what I've done so far:
$ git branch
* master
$ git status
# On branch master
nothing to commit (working directory clean)
$ git branch mywork
$ git checkout mywork
$ git branch
* mywork
master
...modify some files...
$ git status
# On branch mywork
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: file1.html
# modified: file2.html
#
no changes added to commit (use "git add" and/or "git commit -a")
Now if I switch to my other branch, I expect my changes to stay within this branch. However, it looks like the changes come with me:
$ git checkout master
M file1.html
M file2.html
Switched to branch 'master'
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: file1.html
# modified: file2.html
#
no changes added to commit (use "git add" and/or "git commit -a")
Am I doing something wrong? Or am I misunderstanding my use of Git?