From fd49a1b8212099601010203d78ab1d016f142a56 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sun, 9 Dec 2018 07:55:07 -0500 Subject: [PATCH] interactive staging: minor rewording, semantic cleanup Reword some phrases, and emphasize the single-letter command for each interactive staging subcommand rather than the corresponding number. Signed-off-by: Robert P. J. Day --- .../sections/interactive-staging.asc | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/book/07-git-tools/sections/interactive-staging.asc b/book/07-git-tools/sections/interactive-staging.asc index 12b6a4f7f..f9ba5edd6 100644 --- a/book/07-git-tools/sections/interactive-staging.asc +++ b/book/07-git-tools/sections/interactive-staging.asc @@ -1,9 +1,9 @@ [[_interactive_staging]] === Interactive Staging -In this section, you’ll look at a few interactive Git commands that can help you easily craft your commits to include only certain combinations and parts of files. -These tools are helpful if you modify a number of files and then decide that you want those changes to be in several focused commits rather than one big messy commit. -This way, you can make sure your commits are logically separate changesets and can be easily reviewed by the developers working with you. +In this section, you’ll look at a few interactive Git commands that can help you craft your commits to include only certain combinations and parts of files. +These tools are helpful if you modify a number of files extensively, then decide that you want those changes to be partitioned into several focused commits rather than one big messy commit. +This way, you can make sure your commits are logically separate changesets and can be reviewed easily by the developers working with you. If you run `git add` with the `-i` or `--interactive` option, Git enters an interactive shell mode, displaying something like this: @@ -28,11 +28,11 @@ After this comes a ``Commands'' section, which allows you to do a number of thin ==== Staging and Unstaging Files -If you type `2` or `u` at the `What now>` prompt, you're prompted for which files you want to stage: +If you type `u` or `2` (for update) at the `What now>` prompt, you're prompted for which files you want to stage: [source,console] ---- -What now> 2 +What now> u staged unstaged path 1: unchanged +0/-1 TODO 2: unchanged +1/-1 index.html @@ -63,7 +63,7 @@ updated 2 paths *** Commands *** 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp -What now> 1 +What now> s staged unstaged path 1: +0/-1 nothing TODO 2: +1/-1 nothing index.html @@ -71,14 +71,14 @@ What now> 1 ---- Now you can see that the `TODO` and `index.html` files are staged and the `simplegit.rb` file is still unstaged. -If you want to unstage the `TODO` file at this point, you use the `3` or `r` (for revert) option: +If you want to unstage the `TODO` file at this point, you use the `r` or `3` (for revert) option: [source,console] ---- *** Commands *** 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp -What now> 3 +What now> r staged unstaged path 1: +0/-1 nothing TODO 2: +1/-1 nothing index.html @@ -99,14 +99,14 @@ Looking at your Git status again, you can see that you’ve unstaged the `TODO` *** Commands *** 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp -What now> 1 +What now> s staged unstaged path 1: unchanged +0/-1 TODO 2: +1/-1 nothing index.html 3: unchanged +5/-1 lib/simplegit.rb ---- -To see the diff of what you’ve staged, you can use the `6` or `d` (for diff) command. +To see the diff of what you’ve staged, you can use the `d` or `6` (for diff) command. It shows you a list of your staged files, and you can select the ones for which you would like to see the staged diff. This is much like specifying `git diff --cached` on the command line: @@ -115,7 +115,7 @@ This is much like specifying `git diff --cached` on the command line: *** Commands *** 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp -What now> 6 +What now> d staged unstaged path 1: +1/-1 nothing index.html Review diff>> 1 @@ -139,7 +139,7 @@ With these basic commands, you can use the interactive add mode to deal with you It’s also possible for Git to stage certain _parts_ of files and not the rest. For example, if you make two changes to your `simplegit.rb` file and want to stage one of them and not the other, doing so is very easy in Git. -From the same interactive prompt explained in the previous section, type `5` or `p` (for patch). +From the same interactive prompt explained in the previous section, type `p` or `5` (for patch). Git will ask you which files you would like to partially stage; then, for each section of the selected files, it will display hunks of the file diff and ask if you would like to stage them, one by one: [source,console]