title: How to repair my corrupted local git repo branch and rebase my Github fork?
body: <p>I am new to git and am still trying to get an overall handle on how forks, origins, upstreams, and branches work.</p>
  
  <p>I created a fork in Github, created a local copy of the fork, identified my upstream and origin branches, and created a 'newbranch'. I did my development on my local 'newbranch', pushed it to my fork on Github, and created a pull request back to the upstream repo. Then I made some changes in my fork directly, on Github. Later, I made changes to my local copy without updating from Github. I've resolved this by merging from 'newbranch' in the Github fork.</p>
  
  <p>So far, so good. However, I have now been attempting to update my branch from the upstream repo and have run into trouble.</p>
  
  <p>After committing changes to my 'newbranch' and pushing them to the fork, I did the following:</p>
  
  <pre><code>git fetch upstream
  git checkout master
  git merge upstream/master
  </code></pre>
  
  <p>This resulted in thousands of conflicts. I did a reset to back out the merge but was still left with thousands of modified files in the branch and I can't figure out how to clean them up.</p>
  
  <p>I created 'newbranch' from the 'devel' branch of the upstream repo. If you're wondering why I was messing with the 'master' branch, that makes two of us.</p>
  
  <p>My Github fork says my 'devel' branch is 40,000 commits behind the upstream repo. I would like to clean up my local repo, update my local 'devel' and 'newbranch' branches from the upstream repo, and sync these changes to my Github fork.</p>
  
  <p>Any help in getting out of this mess is greatly appreciated.</p>