Skip to content

Commit fd49a1b

Browse files
committed
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 <[email protected]>
1 parent 7a13f5a commit fd49a1b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

book/07-git-tools/sections/interactive-staging.asc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[[_interactive_staging]]
22
=== Interactive Staging
33

4-
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.
5-
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.
6-
This way, you can make sure your commits are logically separate changesets and can be easily reviewed by the developers working with you.
4+
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.
5+
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.
6+
This way, you can make sure your commits are logically separate changesets and can be reviewed easily by the developers working with you.
77

88
If you run `git add` with the `-i` or `--interactive` option, Git enters an interactive shell mode, displaying something like this:
99

@@ -28,11 +28,11 @@ After this comes a ``Commands'' section, which allows you to do a number of thin
2828

2929
==== Staging and Unstaging Files
3030

31-
If you type `2` or `u` at the `What now>` prompt, you're prompted for which files you want to stage:
31+
If you type `u` or `2` (for update) at the `What now>` prompt, you're prompted for which files you want to stage:
3232

3333
[source,console]
3434
----
35-
What now> 2
35+
What now> u
3636
staged unstaged path
3737
1: unchanged +0/-1 TODO
3838
2: unchanged +1/-1 index.html
@@ -63,22 +63,22 @@ updated 2 paths
6363
*** Commands ***
6464
1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
6565
5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
66-
What now> 1
66+
What now> s
6767
staged unstaged path
6868
1: +0/-1 nothing TODO
6969
2: +1/-1 nothing index.html
7070
3: unchanged +5/-1 lib/simplegit.rb
7171
----
7272

7373
Now you can see that the `TODO` and `index.html` files are staged and the `simplegit.rb` file is still unstaged.
74-
If you want to unstage the `TODO` file at this point, you use the `3` or `r` (for revert) option:
74+
If you want to unstage the `TODO` file at this point, you use the `r` or `3` (for revert) option:
7575

7676
[source,console]
7777
----
7878
*** Commands ***
7979
1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
8080
5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
81-
What now> 3
81+
What now> r
8282
staged unstaged path
8383
1: +0/-1 nothing TODO
8484
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`
9999
*** Commands ***
100100
1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
101101
5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
102-
What now> 1
102+
What now> s
103103
staged unstaged path
104104
1: unchanged +0/-1 TODO
105105
2: +1/-1 nothing index.html
106106
3: unchanged +5/-1 lib/simplegit.rb
107107
----
108108

109-
To see the diff of what you’ve staged, you can use the `6` or `d` (for diff) command.
109+
To see the diff of what you’ve staged, you can use the `d` or `6` (for diff) command.
110110
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.
111111
This is much like specifying `git diff --cached` on the command line:
112112

@@ -115,7 +115,7 @@ This is much like specifying `git diff --cached` on the command line:
115115
*** Commands ***
116116
1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
117117
5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
118-
What now> 6
118+
What now> d
119119
staged unstaged path
120120
1: +1/-1 nothing index.html
121121
Review diff>> 1
@@ -139,7 +139,7 @@ With these basic commands, you can use the interactive add mode to deal with you
139139

140140
It’s also possible for Git to stage certain _parts_ of files and not the rest.
141141
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.
142-
From the same interactive prompt explained in the previous section, type `5` or `p` (for patch).
142+
From the same interactive prompt explained in the previous section, type `p` or `5` (for patch).
143143
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:
144144

145145
[source,console]

0 commit comments

Comments
 (0)