Skip to content

Commit b037ee8

Browse files
authored
Merge pull request #298 from coderefinery/radovan/concepts
Updated the "concepts" episode
2 parents 750d616 + 9e9a140 commit b037ee8

1 file changed

Lines changed: 56 additions & 74 deletions

File tree

content/concepts.md

Lines changed: 56 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
# Concepts around collaboration
22

3-
```{objectives}
3+
:::{objectives}
44
- Be able to decide whether to divide work at the branch level or at the repository level.
5-
```
6-
7-
```{instructor-note}
8-
- 15 min teaching
9-
```
10-
11-
12-
## Motivation
13-
14-
- Someone has given you access to a repository online and you want to contribute?
15-
- We will learn how to make a copy and send changes back.
16-
- Then, we make a "pull request" that allows a review.
17-
- Once we know how code review works, we will be able to propose changes
18-
to repositories of others and review changes submitted by external
19-
contributors.
5+
:::
206

217

228
## Commits, branches, repositories, forks, clones
@@ -33,84 +19,80 @@
3319

3420
## Cloning a repository
3521

36-
In order to make a complete copy a whole repository, the `git clone` command can be used. When cloning, all the files, of all or selected branches, of a repository are copied in one operation. Cloning of a repository is of relevance in a few different situations:
37-
* Working on your own, cloning is the operation that you can use to create multiple instances of a repository on, for instance, a personal computer, a server, and a supercomputer.
38-
* The parent repository could be a repository that you or your colleague own. A common use case for cloning is when working together within a smaller team where everyone has read and write access to the same git repository.
39-
* Alternatively, cloning can be made from a public repository of a code that you would like to use. Perhaps you have no intention to work on the code, but would like to stay in tune with the latest developments, also in-between releases of new versions of the code.
40-
41-
```{figure} img/overview/clone.png
42-
:alt: Cloning
22+
In order to make a complete copy a whole repository, the `git clone` command
23+
can be used. When cloning, all the files, of all or selected branches, of a
24+
repository are copied in one operation. Cloning of a repository is of relevance
25+
in a few different situations:
26+
* Working on your own, cloning is the operation that you can use to create
27+
multiple instances of a repository on, for instance, a personal computer, a
28+
server, and a supercomputer.
29+
* The parent repository could be a repository that you or your colleague own. A
30+
common use case for cloning is when working together within a smaller team
31+
where everyone has read and write access to the same git repository.
32+
* Alternatively, cloning can be made from a public repository of a code that
33+
you would like to use. Perhaps you have no intention to work on the code, but
34+
would like to stay in tune with the latest developments, also in-between
35+
releases of new versions of the code.
36+
37+
38+
:::{figure} img/overview/forkandclone.png
39+
:alt: Forking and cloning
4340
:width: 100%
4441
:class: with-border
4542

46-
Cloning
47-
```
43+
Forking and cloning
44+
:::
4845

4946

5047
## Forking a repository
5148

52-
When a fork is made on GitHub/GitLab a complete copy, of all or selected branches, of the repository is made. The copy will reside under a different account on GitHub/GitLab. Forking of a repository is of high relevance when working with a git repository to which you do not have write access.
53-
* In the fork repository commits can be made to the base branch (`main` or `master`), and to other branches.
54-
* The commits that are made within the branches of the fork repository can be contributed back to the parent repository by means of pull or merge requests.
49+
When a fork is made on GitHub/GitLab a complete copy, of all or selected
50+
branches, of the repository is made. The copy will reside under a different
51+
account on GitHub/GitLab. Forking of a repository is of high relevance when
52+
working with a git repository to which you do not have write access.
53+
- In the fork repository commits can be made to the base branch (`main` or
54+
`master`), and to other branches.
55+
- The commits that are made within the branches of the fork repository can be
56+
contributed back to the parent repository by means of pull or merge requests.
5557

56-
```{figure} img/overview/fork.png
57-
:alt: Forking
58-
:width: 100%
59-
:class: with-border
6058

61-
Forking
62-
```
59+
## Synchronizing changes between repositories
6360

61+
- We need a mechanism to communicate changes between the repositories.
62+
- We will **pull** or **fetch** updates **from** remote repositories (we will soon discuss the difference between pull and fetch).
63+
- We will **push** updates **to** remote repositories.
64+
- We will learn how to suggest changes within repositories on GitHub and across repositories (**pull request**).
65+
- Repositories that are forked or cloned do not automatically synchronize themselves:
66+
We will learn how to update forks (by pulling from the "central" repository).
67+
- A main difference between cloning a repository and forking a repository is that the former
68+
is a general operation for generating copies of a repository to different computers,
69+
whereas forking is a particular operation implemented on GitHub/GitLab.
6470

65-
## Generating from templates and importing
6671

67-
There are two more ways to create "copies" of repositories into your user space:
68-
- A repository can be marked as **template** and new repositories can be
69-
**generated** from it, like using a cookie-cutter.
70-
The newly created repository will start with a new history, only one commit, and not
71-
inherit the history of the template.
72+
## Should we clone or fork?
7273

73-
```{figure} img/overview/generate.png
74-
:alt: Generating from a template
75-
:width: 100%
76-
:class: with-border
74+
Should we all work on forks or should we all work inside one repository?
7775

78-
Generating from a template.
79-
```
76+
- For most small or medium-sized research projects you probably want to **work by
77+
cloning a repository** that all research group has write access to (we will
78+
exercise this in the next section).
8079

81-
- You can **import** a repository from another hosting service or web address.
82-
This will preserve the history of the imported project.
80+
- It's only when you want to contribute to a project that you don't have write
81+
access to that you need to use **forks** (we will practice this as well).
8382

84-
```{figure} img/overview/import.png
85-
:alt: Importing a repository
86-
:width: 100%
87-
:class: with-border
8883

89-
Importing a repository.
90-
```
91-
---
84+
## Generating from templates
9285

93-
```{discussion}
94-
- Visit one of the repositories/projects that you have used recently and try to find out
95-
how many forks exist and where they are.
96-
- In which situations could it be useful to start from a "template" repository by generating?
97-
```
86+
A repository can be marked as **template** and new repositories can be
87+
**generated** from it, like using a cookie-cutter.
9888

89+
The newly created repository will start with a new ("flattened") history, only one commit, and not
90+
inherit the history of the template.
9991

100-
## Synchronizing changes between repositories
101-
102-
- We need a mechanism to communicate changes between the repositories.
103-
- We will **pull** or **fetch** updates **from** remote repositories (we will soon discuss the difference between pull and fetch).
104-
- We will **push** updates **to** remote repositories.
105-
- We will learn how to suggest changes within repositories on GitHub and across repositories (**pull request**).
106-
- Repositories that are forked or cloned do not automatically synchronize themselves:
107-
We will learn how to update forks (by pulling from the "central" repository).
108-
- A main difference between cloning a repository and forking a repository is that the former is a general operation for generating copies of a repository to different computers, whereas forking is a particular operation implemented on GitHub/GitLab.
109-
110-
```{figure} img/overview/forkandclone.png
111-
:alt: Forking and cloning
92+
:::{figure} img/overview/generate.png
93+
:alt: Generating from a template
11294
:width: 100%
11395
:class: with-border
11496

115-
Forking and cloning
116-
```
97+
Generating from a template.
98+
:::

0 commit comments

Comments
 (0)