You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/recording-changes.asc
+16-5
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,9 @@ Changes not staged for commit:
106
106
----
107
107
108
108
The ``CONTRIBUTING.md'' file appears under a section named ``Changed but not staged for commit'' – which means that a file that is tracked has been modified in the working directory but not yet staged.
109
-
To stage it, you run the `git add` command. `git add` is a multipurpose command – you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved. It may be helpful to think of it more as ``add this content to the next commit'' rather than ``add this file to the project''.(((git commands, add)))
109
+
To stage it, you run the `git add` command.
110
+
`git add` is a multipurpose command – you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved.
111
+
It may be helpful to think of it more as ``add this content to the next commit'' rather than ``add this file to the project''.(((git commands, add)))
110
112
Let's run `git add` now to stage the ``CONTRIBUTING.md'' file, and then run `git status` again:
111
113
112
114
[source,console]
@@ -167,7 +169,9 @@ Changes to be committed:
167
169
168
170
==== Short Status
169
171
170
-
While the `git status` output is pretty comprehensive, it's also quite wordy. Git also has a short status flag so you can see your changes in a more compact way. If you run `git status -s` or `git status --short` you get a far more simplified output from the command.
172
+
While the `git status` output is pretty comprehensive, it's also quite wordy.
173
+
Git also has a short status flag so you can see your changes in a more compact way.
174
+
If you run `git status -s` or `git status --short` you get a far more simplified output from the command.
171
175
172
176
[source,console]
173
177
----
@@ -179,7 +183,10 @@ M lib/simplegit.rb
179
183
?? LICENSE.txt
180
184
----
181
185
182
-
New files that aren't tracked have a `??` next to them, new files that have been added to the staging area have an `A`, modified files have an `M` and so on. There are two columns to the output - the left hand column indicates that the file is staged and the right hand column indicates that it's modified. So for example in that output, the `README` file is modified in the working directory but not yet staged, while the `lib/simplegit.rb` file is modified and staged. The `Rakefile` was modified, staged and then modified again, so there are changes to it that are both staged and unstaged.
186
+
New files that aren't tracked have a `??` next to them, new files that have been added to the staging area have an `A`, modified files have an `M` and so on.
187
+
There are two columns to the output - the left hand column indicates that the file is staged and the right hand column indicates that it's modified.
188
+
So for example in that output, the `README` file is modified in the working directory but not yet staged, while the `lib/simplegit.rb` file is modified and staged.
189
+
The `Rakefile` was modified, staged and then modified again, so there are changes to it that are both staged and unstaged.
183
190
184
191
[[_ignoring]]
185
192
==== Ignoring Files
@@ -310,7 +317,8 @@ index 0000000..03902a1
310
317
It's important to note that `git diff` by itself doesn't show all changes made since your last commit – only changes that are still unstaged.
311
318
This can be confusing, because if you've staged all of your changes, `git diff` will give you no output.
312
319
313
-
For another example, if you stage the `CONTRIBUTING.md` file and then edit it, you can use `git diff` to see the changes in the file that are staged and the changes that are unstaged. If our environment looks like this:
320
+
For another example, if you stage the `CONTRIBUTING.md` file and then edit it, you can use `git diff` to see the changes in the file that are staged and the changes that are unstaged.
321
+
If our environment looks like this:
314
322
315
323
[source,console]
316
324
----
@@ -370,7 +378,10 @@ index 8ebb991..643e24f 100644
370
378
[NOTE]
371
379
.Git Diff in an External Tool
372
380
====
373
-
We will continue to use the `git diff` command in various ways throughout the rest of the book. There is another way to look at these diffs if you prefer a graphical or external diff viewing program instead. If you run `git difftool` instead of `git diff`, you can view any of these diffs in software like Araxis, emerge, vimdiff and more. Run `git difftool --tool-help` to see what is available on your system.
381
+
We will continue to use the `git diff` command in various ways throughout the rest of the book.
382
+
There is another way to look at these diffs if you prefer a graphical or external diff viewing program instead.
383
+
If you run `git difftool` instead of `git diff`, you can view any of these diffs in software like Araxis, emerge, vimdiff and more.
384
+
Run `git difftool --tool-help` to see what is available on your system.
0 commit comments