mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
Add Aborting Git Commits And Rebases as a vim til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||||
|
|
||||||
_696 TILs and counting..._
|
_697 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -674,6 +674,7 @@ _696 TILs and counting..._
|
|||||||
|
|
||||||
### Vim
|
### Vim
|
||||||
|
|
||||||
|
- [Aborting Git Commits And Rebases](vim/aborting-git-commits-and-rebases.md)
|
||||||
- [Absolute And Relative Line Numbers](vim/absolute-and-relative-line-numbers.md)
|
- [Absolute And Relative Line Numbers](vim/absolute-and-relative-line-numbers.md)
|
||||||
- [Add A File Without Loading It](vim/add-a-file-without-loading-it.md)
|
- [Add A File Without Loading It](vim/add-a-file-without-loading-it.md)
|
||||||
- [Add Custom Dictionary Words](vim/add-custom-dictionary-words.md)
|
- [Add Custom Dictionary Words](vim/add-custom-dictionary-words.md)
|
||||||
|
|||||||
25
vim/aborting-git-commits-and-rebases.md
Normal file
25
vim/aborting-git-commits-and-rebases.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Aborting Git Commits And Rebases
|
||||||
|
|
||||||
|
When you are amending a commit or doing an interactive rebase of a series of
|
||||||
|
commits, Vim will be open to a buffer full of content related to the
|
||||||
|
respective action. Normally, you'll make some changes, save the buffer, and
|
||||||
|
then quit -- Git will take over from there by processing the commit or
|
||||||
|
rebase.
|
||||||
|
|
||||||
|
What if you find yourself in this situation and you want to cancel the commit or
|
||||||
|
rebase? Simply quitting with text already in the buffer will be interpreted
|
||||||
|
by Git as a signal to go ahead and process the commit/rebase.
|
||||||
|
|
||||||
|
So, how do we quit without confirming the action?
|
||||||
|
|
||||||
|
Vim allows you to quit with an error code.
|
||||||
|
|
||||||
|
```
|
||||||
|
:cq
|
||||||
|
```
|
||||||
|
|
||||||
|
This means that irrespective of the content of the buffer, Vim will signal
|
||||||
|
to Git with an error code to not process the commit or rebase, effectively
|
||||||
|
aborting the action.
|
||||||
|
|
||||||
|
See `:help cq` for more details.
|
||||||
Reference in New Issue
Block a user