Skip to content

Commit a91233e

Browse files
committed
Add callouts explaining branches
Addresses #54.
1 parent 16a41d4 commit a91233e

File tree

4 files changed

+371
-1
lines changed

4 files changed

+371
-1
lines changed

episodes/02-getting-started.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,22 @@ No commits yet
167167
nothing to commit (create/copy files and use "git add" to track)
168168
```
169169

170-
The output tells us that we are on the main branch (more on this later) and that we have nothing to commit (no
170+
The output tells us that we are on the main branch and that we have nothing to commit (no
171171
unsaved changes).
172172

173+
::::::::::::::::::::::::::::::::::::::::: callout
174+
175+
## Branches and commits
176+
177+
Commits in Git are like snapshots of our project.
178+
They are ordered into sequences, or "branches", with each commit pointing back to the one before it in the branch.
179+
Git keeps track of the last commit in each branch with a special label;
180+
in this lesson we mostly use one branch with the label "main".
181+
182+
![](fig/git-branch.svg){alt='The label ‘main’ points to commit c2; c2 points to its parent c1, which points to c0.'}
183+
184+
::::::::::::::::::::::::::::::::::::::::::::::::::
185+
173186
### Two steps: Adding and committing
174187

175188
We will now create and save our first project file. This is a two-step process. First, we **add** any files for which

episodes/05-github-pages.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,20 @@ it's more practical to grant everyone access to commit directly instead.
133133

134134
::::::::::::::::::::::::::::::::::::::::::::::::::
135135

136+
::::::::::::::::::::::::::::::::::::::::: callout
137+
138+
## Branching and merging
139+
140+
Branches get their name because you can create a new one (say, "patch")
141+
that splits off from an existing one like "main",
142+
allowing different sets of changes to be made in parallel.
143+
Later on, Git can take the changes from "patch" and merge (copy) them into the "main" branch.
144+
In the last challenge, GitHub did all this for us in the background.
145+
146+
![](fig/git-branches.svg){alt='The label ‘main’ points to commit c5; c5 points to its parent c3, which points to c1, which points to c0. The label ‘patch’ points to commit c4, which points to c2, which points to c1. Commit c5 also points to c4 as a secondary parent, indicating ‘patch’ was merged into ‘main’.'}
147+
148+
::::::::::::::::::::::::::::::::::::::::::::::::::
149+
136150
:::::::::::::::::::::::::::::::::::::::: challenge
137151

138152
## Optional challenge: Contributing to a page owned by someone else (slightly more complicated way)

episodes/fig/git-branch.svg

Lines changed: 129 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)