0

I pushed up a change but it looks funny in stash compare view. I want to get rid of my last commit and redo it.

I tried both of these

git reset --hard HEAD~
git reset --hard HEAD~2

what does get rid of my commit but then it wants me to do a pull before I can do a push and I get all the changes back.

chobo2
  • 83,322
  • 195
  • 530
  • 832
  • `git push -f` rewrites the history on remote branch, effectively replacing the history with you local version - thus dropping the unwanted commit. – orhtej2 Oct 07 '17 at 21:54
  • do I do this with the command I showed or just alone? – chobo2 Oct 07 '17 at 21:55
  • 1
    `git reset HEAD~1` removes the commit from your local branch. `git push -f` then pushes that to remote counterpart. – orhtej2 Oct 07 '17 at 21:59
  • 3
    Possible duplicate of [Rolling back local and remote git repository by 1 commit](https://stackoverflow.com/questions/4647301/rolling-back-local-and-remote-git-repository-by-1-commit) – phd Oct 07 '17 at 22:43

0 Answers0