title: Switch a branch and preserve current branch changes in Git
body: <p>How do I switch the branch and still preserve my current branch changes?</p>
  
  <p>Consider this scenario.</p>
  
  <p>I am working on an issue and as per our development model, I create a separate branch and start working on it. I created my new branch using</p>
  
  <blockquote>
    <p>git checkout -b new_branch</p>
  </blockquote>
  
  <p>Now it works fine when I do any changes in this branch.</p>
  
  <p>But after this I forgot and switched back to default local branch(say "local"), due to system restart.</p>
  
  <p>Now I started working on my fixes and suddenly realize that I am in "local" branch. Now because I have to commit my changes and merge it with master.</p>
  
  <p>I am trying to do </p>
  
  <blockquote>
    <p>git checkout new_branch</p>
  </blockquote>
  
  <p>But I keep getting this error which says : </p>
  
  <blockquote>
    <p>error: Your local changes to the following files would be overwritten
    by checkout:
            content/some/blah/blah/path_name/file.jsp</p>
    
    <p>Please, commit your changes or stash them before you can switch
    branches. Aborting</p>
  </blockquote>
  
  <p>How can I switch to the new_branch and still preserve my changes in local branch which I want to actually commit in new_branch.</p>
  
  <p>PS :- stashing is not an option. Neither is git checkout on local branch. I want to preserve the changes.</p>