WEBVTT

1
00:00:00.000 --> 00:00:02.566
This module challenge is
about choosing what belongs

2
00:00:02.612 --> 00:00:05.654
in a commit and recovering from
a harmless selection mistake.

3
00:00:06.257 --> 00:00:10.518
We will keep a useful README change while
excluding generated teaching output.

4
00:00:10.646 --> 00:00:13.177
The task is small, but
the habit matters whenever

5
00:00:13.223 --> 00:00:17.217
an agent or a build creates files that
you did not intend to preserve in history.

6
00:00:18.030 --> 00:00:21.861
Use the disposable CP01 practice
repository with an existing

7
00:00:21.942 --> 00:00:24.996
baseline commit. That
starting condition matters.

8
00:00:25.379 --> 00:00:29.953
We will deliberately stage a new temporary
file after history already exists.

9
00:00:30.394 --> 00:00:34.098
Do not perform this exercise in your
home directory or an unrelated work

10
00:00:34.156 --> 00:00:37.918
repository, and do not use a real
credential as the example of something

11
00:00:37.964 --> 00:00:41.993
that should not be committed. Create
a file named build-note dot tmp

12
00:00:42.434 --> 00:00:46.010
containing the harmless teaching
sentence supplied in the exercise.

13
00:00:46.335 --> 00:00:48.472
It represents generated output.

14
00:00:48.855 --> 00:00:52.419
Also make a useful README
clarification that you want to keep.

15
00:00:52.802 --> 00:00:57.621
Stage both files deliberately. The
mistake is now concrete and recoverable:

16
00:00:57.946 --> 00:01:01.498
one selected path belongs in the
commit, while the other does not.

17
00:01:01.881 --> 00:01:04.227
Before changing anything, inspect state.

18
00:01:04.505 --> 00:01:08.186
Run Git status, the ordinary
diff, and the cached diff.

19
00:01:08.511 --> 00:01:12.702
Identify the useful README content
and the temporary file's contents.

20
00:01:13.654 --> 00:01:17.624
A final summary saying two files
changed is less useful than seeing

21
00:01:17.682 --> 00:01:21.340
exactly what those files contain.
Your recovery should follow

22
00:01:21.386 --> 00:01:25.299
from that evidence rather than a memorized
command chosen from a search result.

23
00:01:26.111 --> 00:01:30.152
State the goal in plain language.
Preserve the README improvement.

24
00:01:30.395 --> 00:01:33.971
Remove the temporary file from the
next commit. Keep the working file

25
00:01:34.018 --> 00:01:37.837
available so we can demonstrate
that unstaging is not deletion.

26
00:01:38.162 --> 00:01:41.460
Add a narrow ignore rule appropriate
to this teaching artifact.

27
00:01:41.785 --> 00:01:45.233
These outcomes let us judge the
recovery independently of whether

28
00:01:45.280 --> 00:01:47.532
the terminal ends with
a reassuring message.

29
00:01:47.973 --> 00:01:51.979
Run the restore command with the staged
option and the exact temporary path.

30
00:01:52.362 --> 00:01:56.727
The staged option changes the index.
It does not discard the working file.

31
00:01:57.168 --> 00:02:00.628
Inspect status again and open
the temporary file in the editor.

32
00:02:01.011 --> 00:02:04.076
It should still exist with the
same harmless content, while

33
00:02:04.099 --> 00:02:06.329
it is no longer selected
for the next commit.

34
00:02:06.770 --> 00:02:09.637
This differs from restoring
an uncommitted working edit.

35
00:02:09.962 --> 00:02:14.095
A working-tree restore can discard
selected local content by replacing

36
00:02:14.142 --> 00:02:18.472
it from another state. That is useful when
you explicitly want to throw away an edit,

37
00:02:18.716 --> 00:02:20.736
but it is not what this challenge asks.

38
00:02:21.177 --> 00:02:25.171
Always name whether you are changing
working content, staging selection,

39
00:02:25.229 --> 00:02:28.329
or recorded history before
choosing a recovery command.

40
00:02:28.712 --> 00:02:33.600
Now edit dot gitignore. Add an
exact entry for build-note dot tmp.

41
00:02:34.041 --> 00:02:37.570
In actual project work, generated
output should normally go

42
00:02:37.617 --> 00:02:41.831
in the documented build directory and
use the project's existing exclusions.

43
00:02:42.273 --> 00:02:45.767
Our exact teaching entry keeps
the example easy to inspect.

44
00:02:46.092 --> 00:02:49.993
Avoid a broad pattern that might hide
real source files or fixtures just

45
00:02:50.040 --> 00:02:53.941
because their names happen to match.
Ignore rules apply to matching

46
00:02:54.057 --> 00:02:58.213
untracked files. They do not remove a
file that was already tracked in a commit,

47
00:02:58.329 --> 00:03:00.918
and they do not erase
sensitive content from history.

48
00:03:01.522 --> 00:03:05.063
That is why we specified the starting
state and chose harmless output.

49
00:03:05.388 --> 00:03:08.882
A previously committed artifact
requires a different cleanup decision.

50
00:03:09.324 --> 00:03:13.805
Do not assume that adding an ignore rule
can repair every version-control mistake.

51
00:03:14.130 --> 00:03:16.847
Stage the intended README
and ignore changes,

52
00:03:17.021 --> 00:03:20.934
then inspect the cached diff. The
useful clarification should be present.

53
00:03:21.026 --> 00:03:23.685
The ignore rule should be
narrow and understandable.

54
00:03:24.010 --> 00:03:27.064
The temporary file should be
absent from the selected snapshot.

55
00:03:27.342 --> 00:03:31.069
If you simply discarded all changes,
the unwanted file might disappear

56
00:03:31.116 --> 00:03:34.877
from the diff, but you would also lose
the improvement and fail the task.

57
00:03:35.260 --> 00:03:38.883
Commit the reviewed selection with a
message explaining the actual result.

58
00:03:39.324 --> 00:03:42.737
Inspect the history and current
commit summary. The message should fit

59
00:03:42.772 --> 00:03:47.381
the content: a report clarification and
its relevant generated-output exclusion.

60
00:03:47.985 --> 00:03:51.201
If the two ideas are
unrelated in your own project,

61
00:03:51.480 --> 00:03:54.638
separate commits may be
clearer. In this challenge,

62
00:03:54.754 --> 00:03:58.806
explain the boundary you chose rather
than relying on a generic update message.

63
00:03:59.247 --> 00:04:01.104
Now check the working state again.

64
00:04:01.383 --> 00:04:06.306
The harmless temporary file can remain on
disk while being ignored. That is normal.

65
00:04:06.747 --> 00:04:11.159
A clean ordinary status does not mean
the folder contains only committed files.

66
00:04:11.542 --> 00:04:13.945
It means the comparison
and untracked listing

67
00:04:14.038 --> 00:04:16.755
follow Git's tracking and ignore rules.

68
00:04:17.451 --> 00:04:21.294
Understanding that distinction prevents
confusion when generated artifacts

69
00:04:21.422 --> 00:04:25.845
still appear in the file explorer.
Write your review note using four fields.

70
00:04:26.124 --> 00:04:29.328
Describe the starting state,
the useful content to preserve,

71
00:04:29.479 --> 00:04:32.068
the targeted operation,
and the observed result.

72
00:04:32.451 --> 00:04:34.738
Include the actual command and path.

73
00:04:34.982 --> 00:04:38.349
This short record is more useful
than a statement that Git was fixed,

74
00:04:38.523 --> 00:04:42.807
because it explains which data changed and
which data remained available. Consider

75
00:04:42.865 --> 00:04:45.129
how the same pattern
applies to agent work.

76
00:04:45.338 --> 00:04:48.148
An assistant might create
a draft note, build output,

77
00:04:48.229 --> 00:04:52.420
or a source edit during a task. You do
not need to commit everything it produced.

78
00:04:52.664 --> 00:04:55.822
Inspect each artifact against
the purpose of the change.

79
00:04:56.066 --> 00:04:59.665
Preserve useful work, exclude
generated material appropriately,

80
00:04:59.781 --> 00:05:03.588
and make the final selected snapshot
easy for another person to review.

81
00:05:04.099 --> 00:05:07.455
Try predicting the file explorer
and status display before each step.

82
00:05:08.058 --> 00:05:10.241
After unstaging, the
temporary file remains

83
00:05:10.287 --> 00:05:12.528
visible on disk and may
appear as untracked.

84
00:05:13.039 --> 00:05:17.021
After adding the exact ignore rule,
it remains on disk but ordinarily stops

85
00:05:17.056 --> 00:05:20.922
appearing as an untracked candidate.
Those predictions help you understand

86
00:05:20.969 --> 00:05:24.522
the mechanism instead of memorizing
a successful command sequence.

87
00:05:24.963 --> 00:05:28.608
If the result differs, inspect
whether the file was already tracked,

88
00:05:28.782 --> 00:05:32.532
whether the pattern matches, and whether
you are in the intended repository.

89
00:05:33.043 --> 00:05:36.340
Complete the exercise by
submitting before-and-after state,

90
00:05:36.549 --> 00:05:40.195
the final commit summary, and
your explanation of unstage,

91
00:05:40.287 --> 00:05:43.469
discard, and ignore.
Then take the module quiz.

92
00:05:43.910 --> 00:05:47.683
If you confuse two operations,
repeat the disposable example

93
00:05:47.730 --> 00:05:51.050
slowly and predict the affected
state before running the command.

94
00:05:51.561 --> 00:05:54.568
You are ready for GitHub when
you can preserve a meaningful

95
00:05:54.649 --> 00:05:57.865
local history and explain exactly
what will be synchronized.
