You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: ch00git/01Intro.ipynb.py
+14-14
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,10 @@
12
12
# ---
13
13
14
14
# %% [markdown]
15
-
# ## Introduction
15
+
# # Introduction
16
16
17
17
# %% [markdown]
18
-
# ### What's version control?
18
+
# ## What's version control?
19
19
#
20
20
# Version control is a tool for __managing changes__ to a set of files.
21
21
#
@@ -28,7 +28,7 @@
28
28
# - ...
29
29
30
30
# %% [markdown]
31
-
# ### Why use version control?
31
+
# ## Why use version control?
32
32
#
33
33
# - Better kind of __backup__.
34
34
# - Review __history__ ("When did I introduce this bug?").
@@ -43,14 +43,14 @@
43
43
# - "How can I submit a change to someone else's code?"
44
44
# - "How can I merge my work with Sue's?"
45
45
#
46
-
# ### Git != GitHub
46
+
# ## Git != GitHub
47
47
#
48
48
# - __Git__: version control system tool to manage source code history.
49
49
#
50
50
# - __GitHub__: hosting service for Git repositories.
51
51
52
52
# %% [markdown]
53
-
# ### How do we use version control?
53
+
# ## How do we use version control?
54
54
#
55
55
# Do some programming, then commit our work:
56
56
#
@@ -65,7 +65,7 @@
65
65
# Mistake is undone.
66
66
67
67
# %% [markdown]
68
-
# ### What is version control? (Team version)
68
+
# ## What is version control? (Team version)
69
69
#
70
70
# Graham | Eric
71
71
# ------------------ |------
@@ -82,7 +82,7 @@
82
82
# `my_vcs commit` | ...
83
83
84
84
# %% [markdown]
85
-
# ### Scope
85
+
# ## Scope
86
86
#
87
87
# This course will use the `git` version control system, but much of what you learn will be valid with other version control
88
88
# tools you may encounter, including subversion (`svn`) and mercurial (`hg`).
@@ -91,28 +91,28 @@
91
91
# ## Practising with Git
92
92
93
93
# %% [markdown]
94
-
# ### Example Exercise
94
+
# ## Example Exercise
95
95
#
96
96
# 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.
97
97
#
98
98
# 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.
99
99
100
100
# %% [markdown]
101
-
# ### Programming and documents
101
+
# ## Programming and documents
102
102
#
103
103
# 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.
104
104
#
105
105
# In later parts of the course, you will use the version control tools you learn today with actual Python code.
106
106
107
107
# %% [markdown]
108
-
# ### Markdown
108
+
# ## Markdown
109
109
#
110
110
# 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.
111
111
#
112
112
# 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).
113
113
114
114
# %% [markdown]
115
-
# ### Displaying Text in this Tutorial
115
+
# ## Displaying Text in this Tutorial
116
116
#
117
117
# This tutorial is based on use of the Git command line. So you'll be typing commands in the shell.
118
118
@@ -145,7 +145,7 @@
145
145
# On either Windows, Mac or Linux, we recommend [VS Code](https://code.visualstudio.com/).
# 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 @@
173
173
# %% [markdown]
174
174
# ## Solo work
175
175
#
176
-
# ### Configuring Git with your name and email
176
+
# ## Configuring Git with your name and email
177
177
#
178
178
# First, we should configure Git to know our name and email address:
179
179
@@ -191,7 +191,7 @@
191
191
# 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/).
192
192
193
193
# %% [markdown]
194
-
# ### Initialising the repository
194
+
# ## Initialising the repository
195
195
#
196
196
# Now, we will tell Git to track the content of this folder as a git "repository".
Copy file name to clipboardexpand all lines: ch00git/02Solo.ipynb.py
+17-17
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
# ---
13
13
14
14
# %% [markdown]
15
-
# ## Solo work with Git
15
+
# # Solo work with Git
16
16
17
17
# %% [markdown]
18
18
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
@@ -31,7 +31,7 @@
31
31
working_dir
32
32
33
33
# %% [markdown]
34
-
# ### A first example file
34
+
# ## A first example file
35
35
#
36
36
# So let's create an example file, and see how to start to manage a history of changes to it.
37
37
@@ -50,7 +50,7 @@
50
50
# cat index.md
51
51
52
52
# %% [markdown]
53
-
# ### Telling Git about the File
53
+
# ## Telling Git about the File
54
54
#
55
55
# So, let's tell Git that `index.md` is a file which is important, and we would like to keep track of its history:
56
56
@@ -60,7 +60,7 @@
60
60
# %% [markdown]
61
61
# Don't forget: Any files in repositories which you want to "track" need to be added with `git add` after you create them.
62
62
#
63
-
# ### Our first commit
63
+
# ## Our first commit
64
64
#
65
65
# Now, we need to tell Git to record the first version of this file in the history of changes:
66
66
@@ -73,7 +73,7 @@
73
73
# There's a lot of output there you can ignore for now.
74
74
75
75
# %% [markdown]
76
-
# ### Configuring Git with your editor
76
+
# ## Configuring Git with your editor
77
77
#
78
78
# If you don't type in the log message directly with -m "Some message", then an editor will pop up, to allow you
79
79
# to edit your message on the fly.
@@ -102,7 +102,7 @@
102
102
# 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).
103
103
104
104
# %% [markdown]
105
-
# ### Git log
105
+
# ## Git log
106
106
#
107
107
# Git now has one change in its history:
108
108
@@ -113,7 +113,7 @@
113
113
# You can see the commit message, author, and date...
114
114
115
115
# %% [markdown]
116
-
# ### Hash Codes
116
+
# ## Hash Codes
117
117
#
118
118
# The commit "hash code", e.g.
119
119
#
@@ -124,7 +124,7 @@
124
124
# (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. )
125
125
126
126
# %% [markdown]
127
-
# ### Nothing to see here
127
+
# ## Nothing to see here
128
128
#
129
129
# 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:
# Deleted lines are prefixed with a minus, added lines prefixed with a plus.
175
175
176
176
# %% [markdown]
177
-
# ### Staging a file to be included in the next commit
177
+
# ## Staging a file to be included in the next commit
178
178
#
179
179
# 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.
180
180
@@ -187,14 +187,14 @@
187
187
# 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.
188
188
189
189
# %% [markdown]
190
-
# ### The staging area
190
+
# ## The staging area
191
191
#
192
192
# 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.
193
193
#
194
194
# 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.)
195
195
196
196
# %% [markdown]
197
-
# ### Message Sequence Charts
197
+
# ## Message Sequence Charts
198
198
199
199
# %% [markdown]
200
200
# 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):
237
237
wsd("Sender->Recipient: Hello\n Recipient->Sender: Message received OK")
238
238
239
239
# %% [markdown]
240
-
# ### The Levels of Git
240
+
# ## The Levels of Git
241
241
242
242
# %% [markdown]
243
243
# Let's make ourselves a sequence chart to show the different aspects of Git we've seen so far:
# Great, we now have a file which contains a mistake.
267
267
268
268
# %% [markdown]
269
-
# ### Carry on regardless
269
+
# ## Carry on regardless
270
270
#
271
271
# 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...
Copy file name to clipboardexpand all lines: ch00git/03Mistakes.ipynb.py
+11-11
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
# ---
13
13
14
14
# %% [markdown]
15
-
# ## Fixing mistakes
15
+
# # Fixing mistakes
16
16
17
17
# %% [markdown]
18
18
# **NOTE:** using bash/git commands is not fully supported on jupyterlite yet (due to single
@@ -31,7 +31,7 @@
31
31
working_dir
32
32
33
33
# %% [markdown]
34
-
# ### Referring to changes with HEAD and ^
34
+
# ## Referring to changes with HEAD and ^
35
35
#
36
36
# The commit we want to revert to is the one before the latest.
37
37
#
@@ -40,7 +40,7 @@
40
40
# 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`.
41
41
42
42
# %% [markdown]
43
-
# ### Reverting
43
+
# ## Reverting
44
44
#
45
45
# Ok, so now we'd like to undo the nasty commit with the lie about Mount Fictional.
46
46
@@ -51,7 +51,7 @@
51
51
# An editor may pop up, with some default text which you can accept and save.
52
52
53
53
# %% [markdown]
54
-
# ### Conflicted reverts
54
+
# ## Conflicted reverts
55
55
#
56
56
# You may, depending on the changes you've tried to make, get an error message here.
57
57
#
@@ -60,28 +60,28 @@
60
60
# 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.
61
61
62
62
# %% [markdown]
63
-
# ### Review of changes
63
+
# ## Review of changes
64
64
#
65
65
# The file should now contain the change to the title, but not the extra line with the lie. Note the log:
# 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.
121
121
122
122
# %% [markdown]
123
-
# ### Resetting the working area
123
+
# ## Resetting the working area
124
124
#
125
125
# When `git reset` removes commits, it leaves your working directory unchanged -- so you can keep the work in the bad change if you want.
0 commit comments