Cancelling commit and push
TweetPosted on Sunday Mar 09, 2014 at 05:17PM in Technology
Cancel a commit
kyle-no-MacBook:hello kyle$ echo CANCEL >> README.md kyle-no-MacBook:hello kyle$ git commit -am 'cancel' [b4 8c2027b] cancel 1 file changed, 1 insertion(+) kyle-no-MacBook:hello kyle$
- Cancel:
kyle-no-MacBook:hello kyle$ git reset HEAD^ Unstaged changes after reset: M README.md kyle-no-MacBook:hello kyle$ git status # On branch b4 # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README.md # no changes added to commit (use "git add" and/or "git commit -a") kyle-no-MacBook:hello kyle$ git log commit 75dc62abde6e533a5aef8ecab248ed4f3bbfe43a Author: lbtc-xxx <lbtc-xxx@example.com> Date: Sun Mar 9 17:40:57 2014 +0900 local1-b4
- If you want to commit again, just do this:
git commit -am 'cancel'
Cancel a push
kyle-no-MacBook:hello kyle$ git push warning: push.default is unset; its implicit value is changing in ... Counting objects: 10, done. Delta compression using up to 8 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (6/6), 498 bytes | 0 bytes/s, done. Total 6 (delta 1), reused 0 (delta 0) To git@github.com:lbtc-xxx/hello.git bdbe00c..c107ca9 b1 -> b1 75dc62a..9ccae64 b4 -> b4 059de38..30254fe master -> master kyle-no-MacBook:hello kyle$
- Now b4 is:
- Cancelling:
kyle-no-MacBook:hello kyle$ git push -f origin HEAD^:b4 Total 0 (delta 0), reused 0 (delta 0) To git@github.com:lbtc-xxx/hello.git + 9ccae64...75dc62a HEAD^ -> b4 (forced update) kyle-no-MacBook:hello kyle$
- Roll-backed:
References
Tags: git