Skip to content

Commit 7d4ed94

Browse files
MetOffice#69 Reorder history to be after the break
1 parent fa776f0 commit 7d4ed94

File tree

4 files changed

+24
-89
lines changed

4 files changed

+24
-89
lines changed

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ episodes:
6565
- 03-feature-branch.md
6666
- 04-review.md
6767
- Break.md
68+
- 07-history.md
6869
- 05-forks.md
6970
- 06-conflict.md
70-
- 07-history.md
7171
- End.md
7272
- 08-rebase.md
7373
- 09-pre-commit.md

episodes/06-conflict.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,4 +576,3 @@ no longer exists.
576576
- The version control system does not allow people to overwrite each other's changes blindly, but highlights conflicts so that they can be resolved.
577577

578578
::::::::::::::::::::::::::::::::::::::::::::::::::
579-

episodes/07-history.md

Lines changed: 15 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -25,96 +25,32 @@ commands to explore your history.
2525

2626
Your Git history will look different depending on the merge
2727
strategy you use when merging PRs
28-
and whether you allow merging `main` into a feature branch
29-
like we did in the last episode to resolve the conflict.
28+
and whether you allow merging `main` into a feature branch.
3029
It's up to you and your team to decide which strategy is
3130
best for your repository.
3231

32+
::: spoiler
33+
3334
## Viewing History
3435

35-
You have already learnt that we can use the
36-
`git log` command to output the commit history
36+
In the [Introduction to Version Control
37+
with Git](https://www.astropython.com/git-novice/05-history.html) lesson you learnt that we can use the
38+
`git log` command to view the commit history
3739
of our repository.
3840

39-
```bash
40-
$ git log
41-
```
42-
43-
```output
44-
commit acce45c86ece7fd4823ddc6c1addb43edf4c0794
45-
Merge: e3fc783 ca8aca9
46-
Author: Robert FitzRoy <[email protected]>
47-
Date: Mon Sep 23 15:50:15 2024 +0100
48-
49-
Merge pull request #1 from MetOffice/mo-fitzroy-patch-1
50-
51-
Create CITATION.cff
52-
53-
commit ca8aca9f2f43a4d799eb5c9ce9596b42360faa8b
54-
Author: Robert FitzRoy <[email protected]>
55-
Date: Mon Sep 23 15:49:36 2024 +0100
56-
57-
Create CITATION.cff
58-
59-
commit e3fc783648222d5eef0739922b06794b8d690341
60-
Author: Robert FitzRoy <[email protected]>
61-
Date: Fri Sep 20 13:01:05 2024 +0100
62-
63-
Initial commit
64-
```
65-
66-
This shows the first 3 commits to the `git-training-demo` repository (the full output isn't shown here because it's very long).
6741
We can use certain flags with `git log` to better
6842
visualise the history in graph form:
6943

7044
```bash
7145
$ git log --decorate --oneline --graph
7246
```
7347

74-
```output
75-
* d800b46 (HEAD -> main, origin/main, origin/HEAD) Merge pull request #2 from MetOffice/mo-fitzroy-patch-2
76-
|\
77-
| * dbc944d Add pre-commit checks
78-
|/
79-
* acce45c Merge pull request #1 from MetOffice/mo-fitzroy-patch-1
80-
|\
81-
| * ca8aca9 Create CITATION.cff
82-
|/
83-
* e3fc783 Initial commit
84-
```
85-
86-
The [GitHub Documentation for git log](https://git-scm.com/docs/git-log) has information on all the available flags.
87-
The key here is `--graph` shows us the graphical
88-
representation of our history on the left of the
89-
terminal.
90-
`*`'s are commits which are connected by lines.
91-
The vertical lines represent links between commits.
92-
The output above shows two feature branches each with
93-
only one commit which were then merged back into
94-
`main` via a pull request.
95-
96-
You can either remember the flags using
97-
the phrase "git dog", `d` for `--decorate`,
98-
`o` for `--oneline`, `g` for `--graph` or
99-
you can set an alias for the `git log` command:
100-
101-
```bash
102-
$ git config --global alias.dog "log --decorate --oneline --graph"
103-
```
104-
105-
This alias makes these two commands equivalent:
106-
107-
```bash
108-
$ git dog
109-
$ git log --decorate --oneline --graph
110-
```
111-
112-
You can of course customise the log command
113-
with other keywords and set more aliases for
114-
different log views.
115-
Some useful examples can be found on
48+
The [GitHub Documentation for git log](https://git-scm.com/docs/git-log) has information on all the available flags.
49+
Some useful examples of `git log` alias's and flags can be found on
11650
[this Stackoverflow comment](https://stackoverflow.com/questions/1838873/visualizing-branch-topology-in-git/34467298#34467298).
11751

52+
:::
53+
11854
::: callout
11955

12056
### IDE Git History Extensions
@@ -127,14 +63,14 @@ If you use VSCode we recommend the [Git Graph extension](https://marketplace.vis
12763

12864
## Merge Options
12965

130-
When you opened your PRs you were given
66+
When you open a PR you are given
13167
three options for merging your feature
13268
branch into `main`.
13369
We will now explore how each merging method
13470
affects the history of your repository.
13571
In all the examples below we start with the same git history.
13672

137-
### Merge
73+
## Merge
13874

13975
Starting with:
14076

@@ -183,7 +119,7 @@ keeps all the individual commits that made
183119
up your change so more accurately represents
184120
the history of your repository.
185121

186-
### Squash and Merge
122+
## Squash and Merge
187123

188124
Starting with:
189125

@@ -226,7 +162,7 @@ Squashing in this case will make bug hunting harder.
226162
Remember you should try and break work down into
227163
small pieces so you avoid huge branches.
228164

229-
### Rebase
165+
## Rebase
230166

231167
Starting with:
232168

@@ -288,6 +224,6 @@ for your project.
288224
branch into `main`.
289225
- merge: creates a merge commit and results in a non-linear history unless you first rebase your feature branch.
290226
- squash and merge: squashes all your feature branch commits into one merge commit on `main`. Your history is linear.
291-
- rebase: re-writes your git history so that all the feature branch commits are now on `main`. Your history is linear.
227+
- rebase: re-writes your git history so that all the feature branch commits are now on `main`. Your history is linear.
292228

293229
::::::::::::::::::::::::::::::::::::::::::::::::::

instructors/instructor-notes.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ the yellow challenge **Local Cleanup**.
217217

218218
Remember to take regular breaks.
219219

220+
### [History](../episodes/07-history.md)
221+
222+
Users will have covered using `git log` in the intro lesson.
223+
Show learners what the history of the repository looks like now.
224+
Then walk through the merge options, keep it short and snappy.
225+
There are no learner exercises in this episode,
226+
make sure you ask learners what questions they have at the end.
227+
220228
### [Forks](../episodes/05-forks.md)
221229

222230
You can choose here to either change everyone's permissions down
@@ -238,14 +246,6 @@ branches and created their feature branches).
238246
They can bypass protections and do this while the first instructor is teaching.
239247
This generates the citation file conflict the first instructor will point out.
240248

241-
### [History](../episodes/07-history.md)
242-
243-
Users will have covered using `git log` in the intro lesson.
244-
Show learners what the history of the repository looks like now.
245-
Then walk through the merge options, keep it short and snappy.
246-
There are no learner exercises in this episode,
247-
make sure you ask learners what questions they have at the end.
248-
249249
### [End](../episodes/End.md)
250250

251251
What questions do the learners still have?

0 commit comments

Comments
 (0)