Guest User

Untitled

a guest
Feb 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Git Cancel Commit Before Push
  2. #iOSBySheldon
  3.  
  4. Sometimes, we have committed something and then we regret and don't want to push it anymore. In case of this, we can discard our commit, which is better done in terminal, I mean, SourceTree is limited sometime.
  5.  
  6. There are multiple ways to do this, you can rebase, you can reset, today, I will use reset.
  7.  
  8. 1. Soft reset
  9. $ git reset --soft HEAD^
  10.  
  11. 2. Hard reset
  12. $ git reset --hard HEAD~
  13.  
  14. The only difference is that for soft reset, you commit will come back and stay in the staging phase. However, using hard reset, you commit will be gone completely.
  15.  
  16. Therefore, after soft reset, you just need to discard your changes and everything will be alright.
Add Comment
Please, Sign In to add comment