title: How to manage a Git "upstream" branch and related patches?
body: <p>Recently I had an issue where I was given a patch for an assignment, as the professor had changed the code to add new functionality. Unfortunately, I had already put the original codebase in git and had made lots of changes and commits already. The workflow I used to apply the patch is as follows:</p>
  
  <pre><code>git checkout &lt;hash_of_where_patch_should_go&gt;
  git checkout -b patch_branch
  git apply patch
  git add ./* &amp;&amp; git commit -m "applying patch"
  git rebase master patch_branch
      //Fix merge conflicts
  git rebase patch_branch master
  </code></pre>
  
  <p>This worked wonderfully, but my question is this: is this the 'correct' way to perform such a task? It seems to me like there must be a more straightforward way.</p>