Staging and committing
Staging
Section titled “Staging”space stages what is under the cursor: the whole file in the list, one line in the diff, or the whole hunk on a @@ header. a stages the hunk from anywhere inside it.
Both reverse into un-staging when the diff shows the staged side. The pane title says which side you are looking at, and t toggles between them.
small ⎇ main ╭──────────────────────────────────────────────────╮╭──────────────────────────╮ │ Diff — plain.txt (worktree) ││ Files (10) │ │──────────────────────────────────────────────────││──────────────────────────│ │@@ -1,4 +1,4 @@ ││Tracked │ │ 1 1 line1 ││ M logo.png │ │ 2 2 line2 edited ││D main.go │ │ 3 -line3 ││ M noeol.txt │ │ 3+line3 dirty ││ M plain.txt │ │ 4 4 line4 ││ M spaced name.txt │ │ ││A staged.txt │ │ ││ M two-hunks.txt │ │ ││ M ünïcødé-ファイル.txt │ │ ││Untracked │ │ ││?? main.go │ │ ││?? untracked.txt │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ │ ││ │ ╰──────────────────────────────────────────────────╯╰──────────────────────────╯ space stage t staged c commit C amend A stage all U unstage all ? help
The whole tree at once
Section titled “The whole tree at once”Four keys act on everything in the working tree rather than what is under the cursor.
| Key | Action |
|---|---|
A |
stage every change, untracked files included |
U |
unstage everything, leaving the changes in the working tree |
D |
throw away every unstaged change to a tracked file |
X |
delete every untracked file |
A and U are the two halves of the index and cost nothing to undo. D and X lose work, and
they lose different things, which is why they are two keys rather than one: D cannot touch an
untracked file and X cannot touch a tracked one. Each asks first, and X says how many files it
is about to delete. With nothing untracked, X does nothing at all.
Stashing
Section titled “Stashing”| Key | Action |
|---|---|
s |
put every change on the stash, untracked files included |
S |
stash the tracked changes and leave the untracked files where they are |
p |
pop the newest stash back into the working tree |
4 opens the stash view, where p takes the stash under the cursor instead, and
a and d apply and drop one.
How a question is answered
Section titled “How a question is answered”D, X and dropping a stash all ask before they act. A question takes the next key you press:
y goes ahead, ctrl+c quits, and any other key is a no. The key bar says as much while the
question is up: y yes / any key no.
What stages whole
Section titled “What stages whole”Three kinds of change cannot be split and always stage whole:
- a binary file
- a file the change deletes outright
- a hunk that ends without a trailing newline
Committing
Section titled “Committing”c opens the commit message editor. C opens it pre-filled with HEAD’s message, to amend.
| Key | Action |
|---|---|
ctrl+s |
commit |
esc |
cancel and drop the message |
enter |
newline |
ctrl+c |
quit |
enter is a newline because a message with a body is the normal case. The editor owns every other key while it is open, so q types a q and ? types a question mark.
small ⎇ main ╭──────────────────────────────────────────────────────────────────────────────╮ │ Commit │ │──────────────────────────────────────────────────────────────────────────────│ │┃ add a thing │ │┃ │ │┃ Because the other thing needed it. │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ │┃ │ ╰──────────────────────────────────────────────────────────────────────────────╯ ctrl+s commit esc cancel ? help
When a commit fails
Section titled “When a commit fails”git runs your hooks and signs your commits, so a commit can fail for reasons outside bubblegit. The editor stays open, keeps what you wrote, and shows what git said. Fix the cause and press ctrl+s again.