Skip to content

Commit 99c508d

Browse files
author
Lancelot the Brave
committed
Uniform headings + about libraries should be before installing
1 parent c9ab2db commit 99c508d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+374
-385
lines changed

ch00git/01Intro.ipynb.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
# ---
1313

1414
# %% [markdown]
15-
# ## Introduction
15+
# # Introduction
1616

1717
# %% [markdown]
18-
# ### What's version control?
18+
# ## What's version control?
1919
#
2020
# Version control is a tool for __managing changes__ to a set of files.
2121
#
@@ -28,7 +28,7 @@
2828
# - ...
2929

3030
# %% [markdown]
31-
# ### Why use version control?
31+
# ## Why use version control?
3232
#
3333
# - Better kind of __backup__.
3434
# - Review __history__ ("When did I introduce this bug?").
@@ -43,14 +43,14 @@
4343
# - "How can I submit a change to someone else's code?"
4444
# - "How can I merge my work with Sue's?"
4545
#
46-
# ### Git != GitHub
46+
# ## Git != GitHub
4747
#
4848
# - __Git__: version control system tool to manage source code history.
4949
#
5050
# - __GitHub__: hosting service for Git repositories.
5151

5252
# %% [markdown]
53-
# ### How do we use version control?
53+
# ## How do we use version control?
5454
#
5555
# Do some programming, then commit our work:
5656
#
@@ -65,7 +65,7 @@
6565
# Mistake is undone.
6666

6767
# %% [markdown]
68-
# ### What is version control? (Team version)
68+
# ## What is version control? (Team version)
6969
#
7070
# Graham | Eric
7171
# ------------------ |------
@@ -82,7 +82,7 @@
8282
# `my_vcs commit` | ...
8383

8484
# %% [markdown]
85-
# ### Scope
85+
# ## Scope
8686
#
8787
# This course will use the `git` version control system, but much of what you learn will be valid with other version control
8888
# tools you may encounter, including subversion (`svn`) and mercurial (`hg`).
@@ -91,28 +91,28 @@
9191
# ## Practising with Git
9292

9393
# %% [markdown]
94-
# ### Example Exercise
94+
# ## Example Exercise
9595
#
9696
# In this course, we will use, as an example, the development of a few text files containing a description of a topic of your choice.
9797
#
9898
# This could be your research, a hobby, or something else. In the end, we will show you how to display the content of these files as a very simple website.
9999

100100
# %% [markdown]
101-
# ### Programming and documents
101+
# ## Programming and documents
102102
#
103103
# The purpose of this exercise is to learn how to use Git to manage program code you write, not simple text website content, but we'll just use these text files instead of code for now, so as not to confuse matters with trying to learn version control while thinking about programming too.
104104
#
105105
# In later parts of the course, you will use the version control tools you learn today with actual Python code.
106106

107107
# %% [markdown]
108-
# ### Markdown
108+
# ## Markdown
109109
#
110110
# The text files we create will use a simple "wiki" markup style called [markdown](http://daringfireball.net/projects/markdown/basics) to show formatting. This is the convention used in this file, too.
111111
#
112112
# You can view the content of this file in the way Markdown renders it by looking on the [web](https://github.com/UCL/ucl_software_carpentry/blob/master/git/git_instructions.md), and compare the [raw text](https://raw.github.com/UCL/ucl_software_carpentry/master/git/git_instructions.md).
113113

114114
# %% [markdown]
115-
# ### Displaying Text in this Tutorial
115+
# ## Displaying Text in this Tutorial
116116
#
117117
# This tutorial is based on use of the Git command line. So you'll be typing commands in the shell.
118118

@@ -145,7 +145,7 @@
145145
# On either Windows, Mac or Linux, we recommend [VS Code](https://code.visualstudio.com/).
146146

147147
# %% [markdown]
148-
# ### Setting up somewhere to work
148+
# ## Setting up somewhere to work
149149

150150
# %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash"
151151
# rm -rf learning_git/git_example # Just in case it's left over from a previous class; you won't need this
@@ -173,7 +173,7 @@
173173
# %% [markdown]
174174
# ## Solo work
175175
#
176-
# ### Configuring Git with your name and email
176+
# ## Configuring Git with your name and email
177177
#
178178
# First, we should configure Git to know our name and email address:
179179

@@ -191,7 +191,7 @@
191191
# Historically, the default branch was named `master`. Nowadays, the community and most of the hosting sites have changed the default ([read about this change in GitHub](https://github.com/github/renaming/) and [Gitlab](https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/).
192192

193193
# %% [markdown]
194-
# ### Initialising the repository
194+
# ## Initialising the repository
195195
#
196196
# Now, we will tell Git to track the content of this folder as a git "repository".
197197

ch00git/02Solo.ipynb.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# ---
1313

1414
# %% [markdown]
15-
# ## Solo work with Git
15+
# # Solo work with Git
1616

1717
# %% [markdown]
1818
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
@@ -31,7 +31,7 @@
3131
working_dir
3232

3333
# %% [markdown]
34-
# ### A first example file
34+
# ## A first example file
3535
#
3636
# So let's create an example file, and see how to start to manage a history of changes to it.
3737

@@ -50,7 +50,7 @@
5050
# cat index.md
5151

5252
# %% [markdown]
53-
# ### Telling Git about the File
53+
# ## Telling Git about the File
5454
#
5555
# So, let's tell Git that `index.md` is a file which is important, and we would like to keep track of its history:
5656

@@ -60,7 +60,7 @@
6060
# %% [markdown]
6161
# Don't forget: Any files in repositories which you want to "track" need to be added with `git add` after you create them.
6262
#
63-
# ### Our first commit
63+
# ## Our first commit
6464
#
6565
# Now, we need to tell Git to record the first version of this file in the history of changes:
6666

@@ -73,7 +73,7 @@
7373
# There's a lot of output there you can ignore for now.
7474

7575
# %% [markdown]
76-
# ### Configuring Git with your editor
76+
# ## Configuring Git with your editor
7777
#
7878
# If you don't type in the log message directly with -m "Some message", then an editor will pop up, to allow you
7979
# to edit your message on the fly.
@@ -102,7 +102,7 @@
102102
# I'm going to be using `nano` as my editor, but you can use whatever editor you prefer. Find how to setup your favourite editor in [the setup chapter of Software Carpentry's Git lesson](https://swcarpentry.github.io/git-novice/02-setup.html).
103103

104104
# %% [markdown]
105-
# ### Git log
105+
# ## Git log
106106
#
107107
# Git now has one change in its history:
108108

@@ -113,7 +113,7 @@
113113
# You can see the commit message, author, and date...
114114

115115
# %% [markdown]
116-
# ### Hash Codes
116+
# ## Hash Codes
117117
#
118118
# The commit "hash code", e.g.
119119
#
@@ -124,7 +124,7 @@
124124
# (This is a really long code, but whenever you need to use it, you can just use the first few characters, however many characters is long enough to make it unique, `c438` for example. )
125125

126126
# %% [markdown]
127-
# ### Nothing to see here
127+
# ## Nothing to see here
128128
#
129129
# Note that git will now tell us that our "working directory" is up-to-date with the repository: there are no changes to the files that aren't recorded in the repository history:
130130

@@ -150,7 +150,7 @@
150150
# cat index.md
151151

152152
# %% [markdown]
153-
# ### Unstaged changes
153+
# ## Unstaged changes
154154

155155
# %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash"
156156
# git status
@@ -174,7 +174,7 @@
174174
# Deleted lines are prefixed with a minus, added lines prefixed with a plus.
175175

176176
# %% [markdown]
177-
# ### Staging a file to be included in the next commit
177+
# ## Staging a file to be included in the next commit
178178
#
179179
# To include the file in the next commit, we have a few choices. This is one of the things to be careful of with git: there are lots of ways to do similar things, and it can be hard to keep track of them all.
180180

@@ -187,14 +187,14 @@
187187
# Note that `git add` is the command we use to introduce git to a new file, but also the command we use to "stage" a file to be included in the next commit.
188188

189189
# %% [markdown]
190-
# ### The staging area
190+
# ## The staging area
191191
#
192192
# The "staging area" or "index" is the git jargon for the place which contains the list of changes which will be included in the next commit.
193193
#
194194
# You can include specific changes to specific files with `git add`, commit them, add some more files, and commit them. (You can even add specific changes within a file to be included in the index.)
195195

196196
# %% [markdown]
197-
# ### Message Sequence Charts
197+
# ## Message Sequence Charts
198198

199199
# %% [markdown]
200200
# In order to illustrate the behaviour of Git, it will be useful to be able to generate figures in Python
@@ -237,7 +237,7 @@ def wsd(code):
237237
wsd("Sender->Recipient: Hello\n Recipient->Sender: Message received OK")
238238

239239
# %% [markdown]
240-
# ### The Levels of Git
240+
# ## The Levels of Git
241241

242242
# %% [markdown]
243243
# Let's make ourselves a sequence chart to show the different aspects of Git we've seen so far:
@@ -251,7 +251,7 @@ def wsd(code):
251251
wsd(message)
252252

253253
# %% [markdown]
254-
# ### Review of status
254+
# ## Review of status
255255

256256
# %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash"
257257
# git status
@@ -266,7 +266,7 @@ def wsd(code):
266266
# Great, we now have a file which contains a mistake.
267267

268268
# %% [markdown]
269-
# ### Carry on regardless
269+
# ## Carry on regardless
270270
#
271271
# In a while, we'll use Git to roll back to the last correct version: this is one of the main reasons we wanted to use version control, after all! But for now, let's do just as we would if we were writing code, not notice our mistake and keep working...
272272

@@ -289,7 +289,7 @@ def wsd(code):
289289
# cat index.md
290290

291291
# %% [markdown]
292-
# ### Review of changes
292+
# ## Review of changes
293293

294294
# %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash"
295295
# git log | head
@@ -301,7 +301,7 @@ def wsd(code):
301301
# git log --oneline
302302

303303
# %% [markdown]
304-
# ### Git Solo Workflow
304+
# ## Git Solo Workflow
305305

306306
# %% [markdown]
307307
# We can make a diagram that summarises the above story:

ch00git/03Mistakes.ipynb.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# ---
1313

1414
# %% [markdown]
15-
# ## Fixing mistakes
15+
# # Fixing mistakes
1616

1717
# %% [markdown]
1818
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
@@ -31,7 +31,7 @@
3131
working_dir
3232

3333
# %% [markdown]
34-
# ### Referring to changes with HEAD and ^
34+
# ## Referring to changes with HEAD and ^
3535
#
3636
# The commit we want to revert to is the one before the latest.
3737
#
@@ -40,7 +40,7 @@
4040
# We could use the hash code (e.g. 73fbeaf) to reference this, but you can also refer to the commit before the `HEAD` as `HEAD^`, the one before that as `HEAD^^`, the one before that as `HEAD~3`.
4141

4242
# %% [markdown]
43-
# ### Reverting
43+
# ## Reverting
4444
#
4545
# Ok, so now we'd like to undo the nasty commit with the lie about Mount Fictional.
4646

@@ -51,7 +51,7 @@
5151
# An editor may pop up, with some default text which you can accept and save.
5252

5353
# %% [markdown]
54-
# ### Conflicted reverts
54+
# ## Conflicted reverts
5555
#
5656
# You may, depending on the changes you've tried to make, get an error message here.
5757
#
@@ -60,28 +60,28 @@
6060
# If that happens, you need to manually edit the file to fix the problem. Skip ahead to the section on resolving conflicts, or ask a demonstrator to help.
6161

6262
# %% [markdown]
63-
# ### Review of changes
63+
# ## Review of changes
6464
#
6565
# The file should now contain the change to the title, but not the extra line with the lie. Note the log:
6666

6767
# %% jupyter={"outputs_hidden": false} language="bash"
6868
# git log --date=short
6969

7070
# %% [markdown]
71-
# ### Antipatch
71+
# ## Antipatch
7272
#
7373
# Notice how the mistake has stayed in the history.
7474
#
7575
# There is a new commit which undoes the change: this is colloquially called an "antipatch".
7676
# This is nice: you have a record of the full story, including the mistake and its correction.
7777

7878
# %% [markdown]
79-
# ### Rewriting history
79+
# ## Rewriting history
8080
#
8181
# It is possible, in git, to remove the most recent change altogether, "rewriting history". Let's make another bad change, and see how to do this.
8282

8383
# %% [markdown]
84-
# ### A new lie
84+
# ## A new lie
8585

8686
# %% jupyter={"outputs_hidden": false}
8787
# %%writefile index.md
@@ -106,7 +106,7 @@
106106
# git log --date=short
107107

108108
# %% [markdown]
109-
# ### Using reset to rewrite history
109+
# ## Using reset to rewrite history
110110

111111
# %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash"
112112
# git reset HEAD^
@@ -115,12 +115,12 @@
115115
# git log --date=short
116116

117117
# %% [markdown]
118-
# ### Covering your tracks
118+
# ## Covering your tracks
119119
#
120120
# The silly spelling *is no longer in the log*. This approach to fixing mistakes, "rewriting history" with `reset`, instead of adding an antipatch with `revert`, is dangerous, and we don't recommend it. But you may want to do it for small silly mistakes, such as to correct a commit message.
121121

122122
# %% [markdown]
123-
# ### Resetting the working area
123+
# ## Resetting the working area
124124
#
125125
# When `git reset` removes commits, it leaves your working directory unchanged -- so you can keep the work in the bad change if you want.
126126

0 commit comments

Comments
 (0)