Skip to content

Commit 53b8c8d

Browse files
committed
Standard cleanup of "Interactive Staging" section
Cleaning includes: - standardize using " -- " for em dash - Rewording for clarity - Add "git" command prefix to sample Git commands
1 parent 8213d3d commit 53b8c8d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

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

4-
Git comes with a couple of scripts that make some command-line tasks easier.
5-
Here, you’ll look at a few interactive commands that can help you easily craft your commits to include only certain combinations and parts of files.
6-
These tools are very helpful if you modify a bunch of files and then decide that you want those changes to be in several focused commits rather than one big messy commit.
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.
76
This way, you can make sure your commits are logically separate changesets and can be easily reviewed by the developers working with you.
8-
If you run `git add` with the `-i` or `--interactive` option, Git goes into an interactive shell mode, displaying something like this:
7+
8+
If you run `git add` with the `-i` or `--interactive` option, Git enters an interactive shell mode, displaying something like this:
99

1010
[source,console]
1111
----
@@ -21,15 +21,14 @@ $ git add -i
2121
What now>
2222
----
2323

24-
You can see that this command shows you a much different view of your staging area basically the same information you get with `git status` but a bit more succinct and informative.
24+
You can see that this command shows you a much different view of your staging area than you're probably used to -- basically, the same information you get with `git status` but a bit more succinct and informative.
2525
It lists the changes you’ve staged on the left and unstaged changes on the right.
2626

27-
After this comes a Commands section.
28-
Here you can do a number of things, including staging files, unstaging files, staging parts of files, adding untracked files, and seeing diffs of what has been staged.
27+
After this comes a ``Commands'' section, which allows you to do a number of things like staging and unstaging files, staging parts of files, adding untracked files, and displaying diffs of what has been staged.
2928

3029
==== Staging and Unstaging Files
3130

32-
If you type `2` or `u` at the `What now>` prompt, the script prompts you for which files you want to stage:
31+
If you type `2` or `u` at the `What now>` prompt, you're prompted for which files you want to stage:
3332

3433
[source,console]
3534
----
@@ -138,9 +137,9 @@ With these basic commands, you can use the interactive add mode to deal with you
138137

139138
==== Staging Patches
140139

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

146145
[source,console]
@@ -199,7 +198,7 @@ It shows you that a couple of lines are staged and a couple are unstaged.
199198
You’ve partially staged this file.
200199
At this point, you can exit the interactive adding script and run `git commit` to commit the partially staged files.
201200

202-
You also don’t need to be in interactive add mode to do the partial-file staging you can start the same script by using `git add -p` or `git add --patch` on the command line.
201+
You also don’t need to be in interactive add mode to do the partial-file staging -- you can start the same script by using `git add -p` or `git add --patch` on the command line.
203202

204-
Furthermore, you can use patch mode for partially resetting files with the `reset --patch` command, for checking out parts of files with the `checkout --patch` command and for stashing parts of files with the `stash save --patch` command.
203+
Furthermore, you can use patch mode for partially resetting files with the `git reset --patch` command, for checking out parts of files with the `git checkout --patch` command and for stashing parts of files with the `git stash save --patch` command.
205204
We'll go into more details on each of these as we get to more advanced usages of these commands.

0 commit comments

Comments
 (0)