Skip to content

Commit 53d5acd

Browse files
committed
differences for PR #1118
1 parent 4dad341 commit 53d5acd

3 files changed

Lines changed: 14 additions & 20 deletions

File tree

04-changes.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ but we haven't told Git we will want to save those changes
286286
nor have we saved them (which we do with `git commit`).
287287
So let's do that now. It is good practice to always review
288288
our changes before saving them. We do this using `git diff`.
289-
This shows us the differences between the current state
290-
of the file and the most recently saved version:
291289

292290
```bash
293291
$ git diff
@@ -447,12 +445,9 @@ $ git add guacamole.md
447445
$ git diff
448446
```
449447

450-
There is no output:
451-
as far as Git can tell,
452-
there's no difference between what it's been asked to save permanently
453-
and what's currently in the directory.
454-
However,
455-
if we do this:
448+
There is no output. Without any arguments, `git diff` compares the working directory and the staging area. After `git add`, the two versions are identical and there is nothing to show.
449+
450+
However, if we do this:
456451

457452
```bash
458453
$ git diff --staged
@@ -473,10 +468,7 @@ index 315bf3a..b36abfd 100644
473468
## Instructions
474469
```
475470

476-
it shows us the difference between
477-
the last committed change
478-
and what's in the staging area.
479-
Let's save our changes:
471+
we can see that by adding the `--staged` argument to the command we are now comparing what’s in the staged area to the last committed change.
480472

481473
```bash
482474
$ git commit -m "Modify guacamole to the traditional recipe"

05-history.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ exercises: 0
2222
::::::::::::::::::::::::::::::::::::::::::::::::::
2323

2424
As we saw in the previous episode, we can refer to commits by their
25-
identifiers. You can refer to the *most recent commit* of the working
26-
directory by using the identifier `HEAD`.
25+
identifiers. Git also provides a special identifier called `HEAD`, which refers to the **most recent commit**.
2726

28-
We've been adding small changes at a time to `guacamole.md`, so it's easy to track our
29-
progress by looking, so let's do that using our `HEAD`s. Before we start,
30-
let's make a change to `guacamole.md`, adding yet another line.
27+
We can use `HEAD` together with commands we already know to examine our project’s history.
28+
29+
Before we start, let's make a change to `guacamole.md` so we have something
30+
to compare. We won’t save this change yet.
3131

3232
```bash
3333
$ nano guacamole.md
@@ -62,7 +62,9 @@ index b36abfd..0848c8d 100644
6262
+An ill-considered change
6363
```
6464

65-
Note that `HEAD` is the default option for `git diff`, so omitting it will not change the command's output at all (give it a try). However, the real power of `git diff` lies in its ability to compare with previous commits. For example, by adding `~1` (where "~" is "tilde", pronounced [**til**\-d*uh*]), we can look at the commit before `HEAD`.
65+
Here we have the difference between the file in our working directory and the most recently committed version.
66+
67+
We can also refer to earlier commits relative to `HEAD`. For example, by adding `~1` (where "~" is "tilde", pronounced [**til**\-d*uh*]), we can look at the commit before `HEAD`.
6668

6769
```bash
6870
$ git diff HEAD~1 guacamole.md

md5sum.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"episodes/01-basics.md" "69958d3c0867518b9b8635c87e6f0fe2" "site/built/01-basics.md" "2026-04-10"
77
"episodes/02-setup.md" "169455416b0e7425b6e3e4a956104471" "site/built/02-setup.md" "2025-01-25"
88
"episodes/03-create.md" "c1198fc3106059d83fd8078d57fbbfef" "site/built/03-create.md" "2024-09-29"
9-
"episodes/04-changes.md" "46193fb34b94ef6364215c895cf75ddb" "site/built/04-changes.md" "2026-01-20"
10-
"episodes/05-history.md" "1db0ac027bd51d7d67562d71a60116c8" "site/built/05-history.md" "2025-01-10"
9+
"episodes/04-changes.md" "ca68b0c695202cc37615b5957cbeda01" "site/built/04-changes.md" "2026-04-10"
10+
"episodes/05-history.md" "60b0896490a7bb6c6135d897d011bc08" "site/built/05-history.md" "2026-04-10"
1111
"episodes/06-ignore.md" "6eceffedf94c557d57c9a774dcc0780b" "site/built/06-ignore.md" "2025-12-08"
1212
"episodes/07-github.md" "0c3825224461906776080bb9d6be191d" "site/built/07-github.md" "2025-12-19"
1313
"episodes/08-collab.md" "26c15a5971a7caef2daf17c84e72d3c9" "site/built/08-collab.md" "2024-09-29"

0 commit comments

Comments
 (0)