Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Git Cancel Commit Before Push
- #iOSBySheldon
- 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.
- There are multiple ways to do this, you can rebase, you can reset, today, I will use reset.
- 1. Soft reset
- $ git reset --soft HEAD^
- 2. Hard reset
- $ git reset --hard HEAD~
- 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.
- Therefore, after soft reset, you just need to discard your changes and everything will be alright.
Add Comment
Please, Sign In to add comment