I use vim for my commit messages and for pull-requests through hub. When editing my commit message, if I realize I've made a mistake and I don't want to commit, and I exit without writing, the commit is aborted. If I do the same thing with hub while creating a pull request, the pull request is created anyways. It seems like the behavior should be consistent with git.
I know that I can delete the pull request message and save instead to abort the pull request, but it is still confusing that it does not work the same way - and it's also extra steps.
When editing my commit message, if I realize I've made a mistake and I don't want to commit, and I exit without writing, the commit is aborted.
This should be the same with hub pull-request
, where if you didn't enter any pull request message, it aborts the pull request since there isn't a subject line.
The exception to this case would be when you open a pull request with only a single commit in the branch. There, the default subject line & pull request body is populated from the information from the commit message, so even if you don't add any of your text, the pull request will be created from this info.
If you're using a text editor like vim that lets you exit with a non-zero status code (:cq
in vim), you can abort the pull-request even if you entered some message and saved.
Can you provide more info about how you tried to cancel a pull request and what was submitted instead? I'd like to fix this if possible. Thanks!
Closing because we _do_ want to allow you to close the text editor without making any changes and open a pull request if it contains only 1 commit, in which case the title and body of the pull request is inherited from that commit. This matches the behavior of GitHub Web Flow.
If you want to abort, you either need to make your editor exit with nonzero status or delete the title or the whole buffer.
Just wanted to say "thanks mislav!" for pointing out the :cq
non-zero Vim exit code, I have used this at least twenty times since I read it a couple of months ago.
@mislav I somehow missed all of these notifications unfortunately :( I was using :q! to quit vim when I wanted to abort the pull-request (this is what I do when I want to abort a commit as well). Thanks for looking into it, sorry for not following up. I'll use :cq in the future.