Skip to content

Commit 8a68e2f

Browse files
committed
feat(15-diffs): Start section on diffs
1 parent a00648d commit 8a68e2f

File tree

7 files changed

+106
-87
lines changed

7 files changed

+106
-87
lines changed

.obsidian/workspace.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"state": {
1414
"type": "markdown",
1515
"state": {
16-
"file": "docs/14-forking-over-code.md",
16+
"file": "docs/18-workflows.md",
1717
"mode": "source",
1818
"source": false
1919
}
@@ -85,7 +85,7 @@
8585
"state": {
8686
"type": "backlink",
8787
"state": {
88-
"file": "docs/14-forking-over-code.md",
88+
"file": "docs/18-workflows.md",
8989
"collapseAll": false,
9090
"extraContext": false,
9191
"sortOrder": "alphabetical",
@@ -102,7 +102,7 @@
102102
"state": {
103103
"type": "outgoing-link",
104104
"state": {
105-
"file": "docs/14-forking-over-code.md",
105+
"file": "docs/18-workflows.md",
106106
"linksCollapsed": false,
107107
"unlinkedCollapsed": true
108108
}
@@ -125,7 +125,7 @@
125125
"state": {
126126
"type": "outline",
127127
"state": {
128-
"file": "docs/14-forking-over-code.md"
128+
"file": "docs/18-workflows.md"
129129
}
130130
}
131131
}
@@ -147,14 +147,20 @@
147147
"table-editor-obsidian:Advanced Tables Toolbar": false
148148
}
149149
},
150-
"active": "d22cb632a0379261",
150+
"active": "e74c320159094cdf",
151151
"lastOpenFiles": [
152-
"assets/Pull-Request-Practice.md",
152+
"assets/Pasted image 20240314154647.png",
153+
"assets/Pasted image 20240314154551.png",
154+
"docs/15-diffs.md",
155+
"assets/diff-difference.png",
156+
"assets/diff-hunk-headers.png",
157+
"assets/diff-header.png",
158+
"docs/18-workflows.md",
153159
"docs/14-forking-over-code.md",
160+
"assets/Pull-Request-Practice.md",
154161
"assets/collaboration.png",
155162
"docs/12-remotely-useful.md",
156163
"docs/98-command-line-extras.md",
157-
"docs/15-workflows.md",
158164
"CONTRIBUTE.md",
159165
"docs/98-command-line-extras.md",
160166
"assets/pasted-image-20240314105028.png",
@@ -167,8 +173,6 @@
167173
"output",
168174
"docs/00-Back.md.md",
169175
"docs/00-Front.md.md",
170-
"assets/pasted-image-20240216114456.png",
171-
"assets/pasted-image-20240216124422.png",
172176
"docs/99-references-and-resources.md",
173177
"docs/08-status-add-commit.md",
174178
"docs/06-read-me.md",
@@ -183,13 +187,8 @@
183187
"docs/05-global-settings.md",
184188
"docs/04-git-started.md",
185189
"docs/02-getting-ready.md",
186-
"docs/03-repositories-and-folders.md",
187-
"docs/01-what-is-version-control.md",
188190
"docs",
189191
"assets/brave_dWSQwZYc3F.mp4",
190-
"assets/2024-03-01_15_03_52-AdyGCode_git-remote-demo-ii-Brave.png",
191-
"assets/2024-03-01_14_57_49-New-repository-Brave.png",
192-
"assets/2024-03-01_14_57_43-New-repository-Brave.png",
193192
"themes",
194193
"ReadMe.md~",
195194
"02-getting-ready.md~",

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This ReadMe does not need a Table of contents, instead we provide links to each
3232
- [12 Remotely useful](docs/12-remotely-useful.md)
3333
- [13 Why, Hello Dolly](13-why-hello-dolly.md)
3434
- [14 Forking over code](docs/14-forking-over-code.md)
35-
- [15 Workflows](docs/15-workflows.md)
35+
- [15 Workflows](docs/18-workflows.md)
3636
-
3737
- ...
3838
- [99 References and Resources](docs/99-references-and-resources.md)

assets/diff-difference.png

43.1 KB
Loading

assets/diff-header.png

41.8 KB
Loading

assets/diff-hunk-headers.png

41 KB
Loading

docs/15-diffs.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Diffs
2+
3+
A diff is a standard representation of the difference between text files or sets of text files.
4+
5+
Diffs are designed to be human readable but IDEs can make them easier to work with.
6+
7+
They provide enough fidelity to be used as a patch to the code you are working on.
8+
9+
When you run `git status` the question is “what is the diff?”
10+
11+
When you run a merge – it is asking the same question.
12+
13+
Pull or push – yep, you guessed it...
14+
15+
## What is the difference?
16+
17+
We will want to know there is a difference, but this is often not enough.
18+
19+
When we know there is a difference, we then want to know what the difference is.
20+
21+
22+
•You saw an example of differences when you ran a pull request
23+
24+
•Discuss on what levels were differences highlighted (folder/file/line/word/character)?
25+
26+
27+
## When can diffs be seen?
28+
29+
•Between files
30+
31+
•Between commits
32+
33+
•Between staging (index) and the object database (repo)
34+
35+
•Between the working copy and any of the above
36+
37+
38+
# Diff Interpretation
39+
40+
### Header
41+
42+
The header shows the files being compared. The two versions of the file being compared are represented by `-` and `+`.
43+
44+
| Symbol | Version |
45+
| ------ | ----------- |
46+
| `+` | New Version |
47+
| `-` | Old Version |
48+
49+
These two symbols are associated with each insertion.
50+
51+
For temporally related changes, an insertion in the past is a deletion in the present.
52+
53+
![](assets/diff-header.png)
54+
55+
### Hunk headers
56+
57+
The hunk headers indicate the line numbers that are affected in the ‘-’ file and the ‘+’ file.
58+
59+
![](assets/diff-hunk-headers.png)
60+
61+
62+
### A difference!
63+
64+
The differences are indicated by `+` and `-`, and associated with the relevant files.
65+
66+
| Symbol | File | Version |
67+
| ------ | ------ | ----------------------- |
68+
| `-` | `---` | Original |
69+
| `+` | `+++` | New |
70+
| | common | No change between files |
71+
72+
For example:
73+
```diff
74+
def main():
75+
- greet("Alice")
76+
+ name = input("Please enter your name: ")
77+
+ greet(name)
78+
```
79+
80+
![](assets/diff-difference.png)
81+
82+
### Challenge
83+
84+
What line numbers in each file do these changes relate to?
85+
86+
87+
88+
# References
89+
90+
Content based on the following:
91+
92+
www.oreilly.com. (n.d.). _3. Looking Around: Investigating Your Git Repository - Head First Git [Book]_. [online] Available at: https://learning.oreilly.com/library/view/head-first-git/9781492092506/ch03.html [Accessed 14 Mar. 2024].

docs/15-workflows.md

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)