title: Git GUI + GitHub, amend last commit is problematic, how to quickly overcome it?
body: <p>The problem is on <code>git gui</code> VERSUS github (when I try to push an ammended commit created with <code>git gui</code>).</p>
  
  <p>Many times, instead of promptly pushing, I just code more.<br>
  When I go to commit and push using <code>git gui</code>, some times I select "amend last commit" just to reuse the commit message at <code>git gui</code>.  </p>
  
  <p>When I remember that this interaction (<code>git gui</code> vs GitHub) will mess things up, I copy the comment at "ammend last commit" option, and select "new commit" back again, and paste the comment on it.<br>
  But right now I forgot and I am on such mess again... GitHub will not allow me to push the ammended commit, it wants me to merge things unnecessarily (because the ammend commit should work, and simply does not).
  So now, my source files are messed (requiring merge, with that merge tags all over preventing compilation), and there are like 20 files messed...  </p>
  
  <p>I have not a previous backup.<br>
  So I could painfully get my previous commit in some way (using some git command line)... but I guess there is some straight forward way to overwrite the files modified to allow manual merging with my latest proper changes.</p>
  
  <p>I am the only one committing files, so this is a <code>git gui</code> versus GitHub bug or limitation for sure.</p>
  
  <p>Summary:<br>
  1) do commit, commit, commit...<br>
  2) do ammend last commit (it may or not cause problem)<br>
  3) do <code>git pull</code> (it may create merge tags messing the files, uncompilable, requiring needles conflict resolve)  </p>
  
  <p>From @VonC answer <code>git log --graph --oneline --decorate --all</code>, the fork seems very clear:  </p>
  
  <pre><code>* d8f3505 (HEAD, master) improving savable helper
  | * 772a6c0 (origin/master, origin/HEAD) improving savable helper
  |/  
  * 15630f3 improving savable helper
  </code></pre>
  
  <p>or</p>
  
  <pre><code>* fdc9ae1 (HEAD, master) improving savable helper
  | * 772a6c0 (origin/master, origin/HEAD) improving savable helper
  |/  
  * 15630f3 improving savable helper
  </code></pre>
  
  <p>so, my latest changes are at d8f3505 or fdc9ae1 (I recovered backups to retry, thats why such number changed).  </p>
  
  <p>this command keeps the merge tags, therefore uncompilable: <code>git reset origin/master</code></p>
  
  <p>this command <code>git reset --hard HEAD@{1}</code> restores the changes at 772a6c0, therefore I lose the latest ones (I still have the backup).</p>
  
  <p>So, how to make the latest (d8f3505 or fdc9ae1 or another new one as soon I recover the backup again), be the one that will win/overwrite the HEAD?</p>
  
  <p>EDIT:<br>
  using <code>git reset --hard 12eb50c</code> (the new id) let me recover the latest changes without merge tags, great!</p>
  
  <p>but now, after <code>git rebase origin/master</code> (that messes the files again, but now I had time to backup the files, in a non test case situation...), I get this message from <code>git gui</code>:
  <a href="https://i.stack.imgur.com/gxYL1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gxYL1.png" alt="enter image description here"></a><br>
  after I accept it, the push from within <code>git gui</code> stopped working, but command line <code>git push</code> gives me this message:</p>
  
  <pre><code>To https://USER@github.com/USER/PROJECT.git
   ! [rejected]        master -&gt; master (non-fast-forward)
  error: failed to push some refs to 'https://USER@github.com/USER/PROJECT.git'
  hint: Updates were rejected because a pushed branch tip is behind its remote
  hint: counterpart. If you did not intend to push that branch, you may want to
  hint: specify branches to push or set the 'push.default' configuration variable
  hint: to 'simple', 'current' or 'upstream' to push only the current branch.
  </code></pre>
  
  <p>unable to push even after <code>git reset --hard 15630f3</code>... if I could prune whatever is after it and just overwrite with my backuped sources...</p>