title: Are code changes supposed to persist across different branches?
body: <p>I am confused about git branch behavior.</p>
  
  <p>I have this git repo:</p>
  
  <pre><code>$ git status
  On branch master
  Your branch is up-to-date with 'origin/master'.
  nothing to commit, working tree clean
  </code></pre>
  
  <p>I create a local branch like so:</p>
  
  <pre><code>$ git checkout -b foo
  Switched to a new branch 'foo'
  $ git branch
  * foo
    master
  $ git status
  On branch foo
  nothing to commit, working tree clean
  </code></pre>
  
  <p>Now I change the README.md file.</p>
  
  <pre><code>$ date &gt;&gt; README.md 
  $ git status
  On branch foo
  Changes not staged for commit:
    (use "git add &lt;file&gt;..." to update what will be committed)
    (use "git checkout -- &lt;file&gt;..." to discard changes in working directory)
  
      modified:   README.md
  
  no changes added to commit (use "git add" and/or "git commit -a")
  </code></pre>
  
  <p>Now I jump back to my master branch like so:</p>
  
  <pre><code>$ git checkout master
  M   README.md
  Switched to branch 'master'
  Your branch is up-to-date with 'origin/master'.
  </code></pre>
  
  <p>But when I do a git status I see that the README.md file has the modification from my foo branch! Shouldn't I be seeing the unmodified version of the README.md file?  What am I doing wrong here?</p>
  
  <pre><code>$ git status
  On branch master
  Your branch is up-to-date with 'origin/master'.
  Changes not staged for commit:
    (use "git add &lt;file&gt;..." to update what will be committed)
    (use "git checkout -- &lt;file&gt;..." to discard changes in working directory)
  
      modified:   README.md
  
  
  no changes added to commit (use "git add" and/or "git commit -a")
  $ tail README.md 
  # README.md
  -----------
  
  Meanvoy is just an idea I had to replace envoy with facter and
  a mean stack backend.
  Fri Mar 17 13:43:04 PDT 2017
  </code></pre>