The : (colon) makes all the difference. Quite dumb really.
$ git push origin :feature/crap_feature
I accidentally staged a file for commit -- but I don't want to.
$ git status
On branch feature/branch
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: staged.py
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: unstaged_1.py
modified: unstaged_2.py
Remove the file from the stage without losing the changes.
$ git reset -- <file>
You changed your mind and you want to discard changes.
$ git checkout -- <file>
$ git format-patch -1 <commit sha>
$ patch -p1 < commit.patch
commit 26d131bbb08f1717913feb5c3afce7bf9abda345
Author: Andrew Artajos <[email protected]>
Date: Thu Mar 23 15:41:37 2017 +1100
case 155
commit 7a2cf4fd4256838cb9617b1ffa409ccf65c741a5
Author: Andrew Artajos <[email protected]>
Date: Thu Mar 23 12:00:25 2017 +1100
case 156
commit e2abb6b03f2fa4e660c357ce899a8ab352fd21b1
Merge: a01ae268 ab29e360
Author: Andrew Artajos <[email protected]>
Date: Thu Mar 23 10:53:38 2017 +1100
case 3
$ git checkout -b two-commits-down e2abb6b03f2fa4e660c357ce899a8ab352fd21b1