title: How to move changes off of the master branch
body: <p>Basic question but this happens to me all the time:</p>
  <ul>
  <li>Make changes in a <code>working-branch</code></li>
  <li>Switch to <code>master</code></li>
  <li><code>git merge working-branch</code></li>
  <li><code>git push</code></li>
  <li><code>cap deploy</code>(to staging)</li>
  <li>make a new cup of tea</li>
  </ul>
  <p>then I come back and think of something else and start making some changes...while still on master.</p>
  <p>What's an easy way to either:</p>
  <ol>
  <li>prevent direct edits on master (warning perhaps)</li>
  <li>move all edits over to <code>working-branch</code> and clear <code>master</code> so I can continue editing on <code>working-branch</code> or</li>
  <li>spin edits into an entirely new branch <code>new-working-branch</code> and then discard <code>working-branch</code>?</li>
  </ol>
  <p>Took a risk and tried the recommendation in the latter part of &quot;Branches&quot; section of <a href="http://longair.net/blog/2009/04/16/git-fetch-and-merge/" rel="nofollow noreferrer">this page</a> but that just wiped out ALL my edits?! Perhaps because after <code>git branch dubious-experiment</code> and <code>git checkout master</code> the <code>git status</code> on both branches was identical (not 'clean' on master). So <code>git reset --hard &lt;SHA1sum&gt;</code> wiped out all changes on both?!</p>
  <pre><code>  git branch dubious-experiment
  
    M---N-----O----P---Q (&quot;master&quot; and &quot;dubious-experiment&quot;)
  
    git checkout master
  
    # Be careful with this next command: make sure &quot;git status&quot; is
    # clean, you're definitely on &quot;master&quot; and the
    # &quot;dubious-experiment&quot; branch has the commits you were working
    # on first...
  
    git reset --hard &lt;SHA1sum of commit N&gt;
  </code></pre>