From 53b8c8dcfe527dfc71fa61b6393a951c715ad111 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Wed, 25 Oct 2017 06:39:45 -0400 Subject: [PATCH] Standard cleanup of "Interactive Staging" section Cleaning includes: - standardize using " -- " for em dash - Rewording for clarity - Add "git" command prefix to sample Git commands --- .../sections/interactive-staging.asc | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/book/07-git-tools/sections/interactive-staging.asc b/book/07-git-tools/sections/interactive-staging.asc index b6f37f71d..094fdb116 100644 --- a/book/07-git-tools/sections/interactive-staging.asc +++ b/book/07-git-tools/sections/interactive-staging.asc @@ -1,11 +1,11 @@ [[_interactive_staging]] === Interactive Staging -Git comes with a couple of scripts that make some command-line tasks easier. -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. -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. +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. -If you run `git add` with the `-i` or `--interactive` option, Git goes into an interactive shell mode, displaying something like this: + +If you run `git add` with the `-i` or `--interactive` option, Git enters an interactive shell mode, displaying something like this: [source,console] ---- @@ -21,15 +21,14 @@ $ git add -i What now> ---- -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. +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. It lists the changes you’ve staged on the left and unstaged changes on the right. -After this comes a Commands section. -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. +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. ==== Staging and Unstaging Files -If you type `2` or `u` at the `What now>` prompt, the script prompts you for which files you want to stage: +If you type `2` or `u` at the `What now>` prompt, you're prompted for which files you want to stage: [source,console] ---- @@ -138,9 +137,9 @@ With these basic commands, you can use the interactive add mode to deal with you ==== Staging Patches -It’s also possible for Git to stage certain parts of files and not the rest. +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 interactive prompt, type `5` or `p` (for patch). +From the same interactive prompt explained in the previous section, type `5` or `p` (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] @@ -199,7 +198,7 @@ It shows you that a couple of lines are staged and a couple are unstaged. You’ve partially staged this file. At this point, you can exit the interactive adding script and run `git commit` to commit the partially staged files. -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. +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. -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. +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. We'll go into more details on each of these as we get to more advanced usages of these commands.