I believe this is already the case: if the change message is empty, or if the file is empty, nothing is done.
if the change message is empty, or if the file is empty, nothing is done.
Yeah. This is exactly what I do when I need to abort. Although this issue seems greater for the OP when amending. Since in that case, the message is already written
I was also thinking about pulling, where there isn’t a message in the first place.
I think what makes this difficult is the fact that the temp file is created with specific contents, which would be valid if quit without saving. (FWIW, the same happens with git commit --amend
.)
Even though the same thing happens with git commit —amend
the commit hash doesn’t change in git when that happens.
Are you sure? I can’t reproduce that behavior.
$ git rev-parse HEAD
1927e40d50528ce3f7a0ebb1138e9b99b7060085
$ git commit --amend
## quit editor without saving and without making any changes
$ git rev-parse HEAD
e0468b8606481afd8d3b1487cc1399c3db5820fc
Sorry, you’re right. The commit hash changes in git.
Another way to “back out” of a recording or commit is to quit the editor with a non-successful exit code. You can do that with :cq
in vim. This aborts the action you were doing even if you saved before you quit the editor.
I don’t think this is fixable, unfortunately. Since I’m trying to decide on the fate of open discussions before the beta, I’m closing this one. If any of yous want to keep discussing it, feel free to reopen.
From
git
I’m used to being able to abort committing by quitting my text editor without saving. Inpijul
, this doesn’t seem to work; quitting seems to be taken as “everything’s in order”. What do you think about changing this to work like ingit
?