Skip to content

Commit aa559b1

Browse files
committed
🎨 format
1 parent b91f8ba commit aa559b1

5 files changed

Lines changed: 78 additions & 87 deletions

File tree

README.md

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
11
# Git Tutorial
22

3-
Sign-Up to the workshop here (being logged in with your DTU Microsoft account): [Sign-Up Form](
4-
https://forms.office.com/e/62H1nV61R0)
3+
Sign-Up to the workshop here (being logged in with your DTU Microsoft account): [Sign-Up Form](https://forms.office.com/e/62H1nV61R0)
54

65
## Announcement
76

87
This workshop will give you the opportunity to practice git as a version control system
9-
and Github as a website to host your repositories. Using git you can track changes in
8+
and Github as a website to host your repositories. Using git you can track changes in
109
folders. It allows you track your progress and to spot random typos when working on
11-
many projects and tasks in parallel. In the workshop you will get the time to practice
10+
many projects and tasks in parallel. In the workshop you will get the time to practice
1211
the fundamental concepts and actions directly in your browser - either using VSCode in
13-
GitHub Codespaces or in using the GitHub web interface. If you want, you can also try
12+
GitHub Codespaces or in using the GitHub web interface. If you want, you can also try
1413
everything on your local computer.
1514

16-
I will give a brief introduction to git. Then you will specific workflows by
15+
I will give a brief introduction to git. Then you will specific workflows by
1716
collaboratively work on extending a [recipe book](https://enryh.github.io/recipe-book/)
1817
(please bring a recipe you like).
19-
You will learn how to work on
20-
[branches](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches),
21-
review [Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
22-
and merge them into the main branch. If you have specific requests, feel free to reach out to me.
18+
You will learn how to work on
19+
[branches](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches),
20+
review [Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
21+
and merge them into the main branch. If you have specific requests, feel free to reach out to me.
2322

2423
If you have specific requests, feel free to reach out to [me](mailto:heweb@dtu.dk) and/or write it down in the sign-up form.
2524

2625
What you'll learn:
26+
2727
- Basic tasks and actions to perform with git (in VSCode or in the browser)
2828
- How to branch and tag
2929
- Follow trunk-based development
3030
- See how to merge and comment a Pull Request based on a branch
3131
- Solve merge conflicts
3232
- Familiarize yourself with VSCode’s and GitHub’s interface and user experience
3333
- Get to know new recipes
34-
35-
Minimal prerequisite: A [GitHub account](https://github.com/signup).
36-
If you want to follow along locally, please install
37-
[GitHub Desktop](https://desktop.github.com/download/) and
34+
35+
Minimal prerequisite: A [GitHub account](https://github.com/signup).
36+
If you want to follow along locally, please install
37+
[GitHub Desktop](https://desktop.github.com/download/) and
3838
[VSCode](https://code.visualstudio.com/) on your machine.
3939

4040
### Brief timeline of the workshop:
4141

42-
| Time | Activity |
43-
|---------------|----------------------------------------------|
44-
| 10:00 - 10:15 | Coffee and snacks 🥐 |
45-
| 10:15 - 10:45 | Introduction and example workflow |
46-
| 10:45 - 12:00 | Working collaboratively on the recipe book |
47-
| 12:00 - 12:30 | lunch break (not included) |
48-
| 12:30 - 13:30 | Your question and advanced content |
49-
42+
| Time | Activity |
43+
| ------------- | ------------------------------------------ |
44+
| 10:00 - 10:15 | Coffee and snacks 🥐 |
45+
| 10:15 - 10:45 | Introduction and example workflow |
46+
| 10:45 - 12:00 | Working collaboratively on the recipe book |
47+
| 12:00 - 12:30 | lunch break (not included) |
48+
| 12:30 - 13:30 | Your question and advanced content |
5049

5150
## Slides
5251

53-
5452
<iframe
5553
src="https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/embed?slide=id.p#slide=id.p"
5654
frameborder="0"
@@ -60,7 +58,6 @@ allowfullscreen="true"
6058
webkitallowfullscreen="true">
6159
</iframe>
6260

63-
6461
## Local Setup
6562

6663
See [local_setup](local_setup.md) for instructions to setup git on your local computer.
@@ -73,35 +70,30 @@ See [local_setup](local_setup.md) for instructions to setup git on your local co
7370
- [Glossary of terms (technical for git)](https://www.git-scm.com/docs/gitglossary)
7471
- [GitHub Glossary terms](https://docs.github.com/en/get-started/learning-about-github/github-glossary)
7572

76-
7773
## Git under the hood (Extended version)
7874

7975
> Extended content for those interested in how git works under the hood
8076
81-
You can find a recording of the
77+
You can find a recording of the
8278
[talk](https://www.youtube.com/watch?v=cAU3BCUkHxM)
83-
([slides](https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/edit?usp=sharing))
84-
and [hands-on tutorial](https://www.youtube.com/watch?v=5iB7qc5zRjQ)
79+
([slides](https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/edit?usp=sharing))
80+
and [hands-on tutorial](https://www.youtube.com/watch?v=5iB7qc5zRjQ)
8581
on YouTube which was done for the Data Club seminar
8682
between DTU biosustain and DTU bioengineering (see sections in description of Video).
8783

8884
Talk:
89-
[![Recording of talk](https://img.youtube.com/vi/cAU3BCUkHxM/maxresdefault.jpg
90-
)](https://www.youtube.com/watch?v=cAU3BCUkHxM)
85+
[![Recording of talk](https://img.youtube.com/vi/cAU3BCUkHxM/maxresdefault.jpg)](https://www.youtube.com/watch?v=cAU3BCUkHxM)
9186

9287
Live Demo:
93-
[![Live Demo of Hands On part](https://img.youtube.com/vi/5iB7qc5zRjQ/maxresdefault.jpg
94-
)](https://www.youtube.com/watch?v=5iB7qc5zRjQ)
88+
[![Live Demo of Hands On part](https://img.youtube.com/vi/5iB7qc5zRjQ/maxresdefault.jpg)](https://www.youtube.com/watch?v=5iB7qc5zRjQ)
9589

9690
The above Live Demo is not pulling the merge commit after merging the branch on GitHub:
9791
[github.com/biosustain/git_training_henry_recording](https://github.com/biosustain/git_training_henry_recording)
9892

9993
I show the merge commit in the video below, cloining the recording repository in a newly
10094
create VSCode sandbox environment above:
10195

102-
[![Live Demo Hand on Addon](https://img.youtube.com/vi/gcfzruIJ-rw/sddefault.jpg
103-
)](https://www.youtube.com/watch?v=gcfzruIJ-rw)
104-
96+
[![Live Demo Hand on Addon](https://img.youtube.com/vi/gcfzruIJ-rw/sddefault.jpg)](https://www.youtube.com/watch?v=gcfzruIJ-rw)
10597

10698
### Instructions
10799

@@ -112,7 +104,7 @@ create VSCode sandbox environment above:
112104
- setup user.name and user.email (see above)
113105
- create files, stage them and see what files are created in `.git/objects`
114106
- commit files and check `.git/objects`
115-
- create branches and checkout `.git/refs` (`git/branches` is a legacy folder,see
107+
- create branches and checkout `.git/refs` (`git/branches` is a legacy folder,see
116108
[here](https://stackoverflow.com/a/10398507/9684872))
117109
- look at `git/HEAD` (maybe `git/ORIG_HEAD` if it exists)
118110

@@ -140,13 +132,12 @@ git log --format=raw -n 3
140132
If you wonder what the codes in a tree mean, check this stackexchange
141133
[answer](https://unix.stackexchange.com/a/450488/349761)
142134

143-
144135
### What's happening?
145136

146137
Can you explain what happens in the following scenarios?
147138

148139
- You committed ten commits and did not yet push. Git complains about too much data.
149-
You realize that you committed your source data. You delete it and commit again,
140+
You realize that you committed your source data. You delete it and commit again,
150141
but the problem still persists.
151142
- You commit something and push. You realize your last commit was wrong. You undo it
152143
and commit again. Git complains that you cannot push.
@@ -157,8 +148,8 @@ Can you explain what happens in the following scenarios?
157148
inner workings
158149
- [git parable](http://practical-neuroimaging.github.io/git_parable.html) - why git came to exist
159150
- Videos:
160-
- [Python-Git-Client](https://www.youtube.com/watch?v=xvzo_nV9PjU)
161-
- [Git-Interals](https://www.youtube.com/watch?v=MYP56QJpDr4) - shows how git works
162-
- [Git PyData Global 2021 talk](https://www.youtube.com/watch?v=rBYC3dEOOyI)
163-
- Scoot Chacon’s [“So you thin you know git” talk](https://www.youtube.com/watch?v=aolI_Rz0ZqY) (FOSDEM 2024),
151+
- [Python-Git-Client](https://www.youtube.com/watch?v=xvzo_nV9PjU)
152+
- [Git-Interals](https://www.youtube.com/watch?v=MYP56QJpDr4) - shows how git works
153+
- [Git PyData Global 2021 talk](https://www.youtube.com/watch?v=rBYC3dEOOyI)
154+
- Scoot Chacon’s [“So you thin you know git” talk](https://www.youtube.com/watch?v=aolI_Rz0ZqY) (FOSDEM 2024),
164155
notes on [blog](https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/)

index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
```{include} README.md
2-
```
32
3+
```
44

55
```{toctree}
66
:maxdepth: 1
@@ -11,7 +11,6 @@ instructions_251105
1111
1212
use_cases
1313
local_setup
14-
1514
```
1615

1716
```{toctree}

instructions_241113.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,45 @@
99
- Introduction to git ([slides](https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/edit?usp=sharing)),
1010
see recording [here](https://youtu.be/cAU3BCUkHxM)
1111
- Hands-on, focusing this time on
12-
- working on a shared repository (per group, i.e. e.g. per table)
13-
- creating and merging branches
14-
- viewing and annotating collaborative work
15-
- showing features of GitHub
12+
- working on a shared repository (per group, i.e. e.g. per table)
13+
- creating and merging branches
14+
- viewing and annotating collaborative work
15+
- showing features of GitHub
1616

1717
If time allows - and maybe due to common errors - we will also cover:
18+
1819
- merge conflicts
1920
- out-of-sync issues
2021

21-
The workshop will require you to have a GitHub account. Please open it here: [github.com/join](https://github.com/join)
22+
The workshop will require you to have a GitHub account. Please open it here: [github.com/join](https://github.com/join)
2223

2324
### 1. step - create a shared repository
2425

2526
> ONLY one person per group has to do this.
2627
2728
Per group (e.g. table) create one repository on GitHub on one of the group members account
2829
or under the DTU biosustain organization.
29-
- Use as template this repository from
30-
[github.com/enryH/notes_template](https://github.com/enryH/notes_template).
31-
Follow the instructions described
32-
[here](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template#creating-a-repository-from-a-template) or
33-
[the demo-recording](https://youtu.be/XolIezJtSPI?t=98) to use it.
30+
31+
- Use as template this repository from
32+
[github.com/enryH/notes_template](https://github.com/enryH/notes_template).
33+
Follow the instructions described
34+
[here](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template#creating-a-repository-from-a-template) or
35+
[the demo-recording](https://youtu.be/XolIezJtSPI?t=98) to use it.
3436

3537
### 2. step - create a clone of the shared repository
3638

37-
Now you have a common repository you can share with each others. You can either
39+
Now you have a common repository you can share with each others. You can either
3840
[work in a codespace](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)
3941
(opening the repository in a virtual machine in the browser) or clone the repository
4042
to your local machine.
4143

42-
- we won't cover the website aspect of the template here, but I created a video on how
43-
to use the template for a website [here](https://www.youtube.com/watch?v=XolIezJtSPI)
44+
- we won't cover the website aspect of the template here, but I created a video on how
45+
to use the template for a website [here](https://www.youtube.com/watch?v=XolIezJtSPI)
4446
(which is also linked in the [repository's README](https://github.com/enryH/notes_template)).
4547

4648
### 3. step - each create a branch
4749

48-
Each of you create a branch, e.g. give it your name. Add a brief description of what you
50+
Each of you create a branch, e.g. give it your name. Add a brief description of what you
4951
are passionate about in a file called `aboutme.md` in a folder with your name.
5052

5153
In order to commit this to the GitHub repository you have to do one of the two options:
@@ -61,7 +63,7 @@ You can also mix both approaches in your group to find out about the differences
6163
6264
### 4. step - merge the branches to the main branch
6365

64-
On GitHub open a pull request to merge your branch to the main branch. We will explore
66+
On GitHub open a pull request to merge your branch to the main branch. We will explore
6567
together some features of the pull request website.
6668

6769
> Hint: Use the extension
@@ -70,28 +72,26 @@ together some features of the pull request website.
7072
7173
### 5. step - view and annotate the collaborative work
7274

73-
Switch back to the `main` branch and get all the latest changes from your coworkers (pull).
74-
Now, each create (again) a new branch (pick a unique new name) and create a the file name `biosustain.md`.
75+
Switch back to the `main` branch and get all the latest changes from your coworkers (pull).
76+
Now, each create (again) a new branch (pick a unique new name) and create a the file name `biosustain.md`.
7577
In this file write a about what you think biosustain is about.
7678

7779
### 6. step - merge the branches to the main branch
7880

79-
The first pull request will work fine. Everyone else has to deal with merge conflicts, as
80-
the same named file will be overwritten - and there is no clear way to say which version
81+
The first pull request will work fine. Everyone else has to deal with merge conflicts, as
82+
the same named file will be overwritten - and there is no clear way to say which version
8183
is the correct one or how to combine you changes.
8284

83-
- Hint: In your CodeSpace make sure to checkout the latest changes from the main branch
85+
- Hint: In your CodeSpace make sure to checkout the latest changes from the main branch
8486
before creating a new branch (pull on main).
8587

8688
### 7. step - merge conflicts
8789

8890
> Advanced!
8991
90-
We will explore how to resolve merge conflicts in VSCode's UI. This is advanced and
92+
We will explore how to resolve merge conflicts in VSCode's UI. This is advanced and
9193
you don't have to do this for now.
9294

9395
## Follow up recording
9496

95-
[![Live Demo of Hands On part](https://img.youtube.com/vi/mX3Il5xvKAs/maxresdefault.jpg
96-
)](https://www.youtube.com/watch?v=mX3Il5xvKAs)
97-
97+
[![Live Demo of Hands On part](https://img.youtube.com/vi/mX3Il5xvKAs/maxresdefault.jpg)](https://www.youtube.com/watch?v=mX3Il5xvKAs)

instructions_251105.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ You need to be logged in to GitHub and have a GitHub account.
1919

2020
- [github.dev/enryH/recipe-book (Editor)](https://github.dev/enryH/recipe-book)
2121
- [github.com/enryH/recipe-book (Website)](https://github.com/enryH/recipe-book)
22+
2223
### In GitHub Workspace
2324

24-
- Open in GitHub Codespace if you want to build and preview the website without
25+
- Open in GitHub Codespace if you want to build and preview the website without
2526
creating a commit:
2627

2728
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=1053356553&skip_quickstart=true)
2829

2930
### On local computer
3031

31-
Install both an editor, e.g. [VSCode](https://code.visualstudio.com/download) (recommended),
32+
Install both an editor, e.g. [VSCode](https://code.visualstudio.com/download) (recommended),
3233
and the command line program [git](https://git-scm.com/install/)
3334

3435
## Exercises
@@ -37,17 +38,17 @@ Choose your favrioute.
3738

3839
### Add your recipe and request a review [basic]
3940

40-
> This I have to test with someone
41+
> This I have to test with someone
4142
42-
- [create a fork](https://github.com/enryH/recipe-book/fork)
43+
- [create a fork](https://github.com/enryH/recipe-book/fork)
4344
(or request access as collaborator of the the recipe-repo)
44-
- add and commit your recipe. The next two steps can be done either as first or
45+
- add and commit your recipe. The next two steps can be done either as first or
4546
second, why?
4647
- create a branch with your new recipe, e.g. `add-aioli-pasta`
4748
- create a commit with your new recipe draft
4849
- open a Pull (Merge) Request on GitHub to `origin/main`
4950
- ask someone (by inviting them) to review your PR and get an approval
50-
- I set-up the repo to require at least one approval before a merge is possible
51+
- I set-up the repo to require at least one approval before a merge is possible
5152
(best-practice)
5253

5354
### Create a merge conflict [medium]
@@ -59,15 +60,16 @@ Work simulatenously on the same files, writing new content to the same sections
5960
- everyone after has to resolve merge conflicts as the changes are not easy to resolve
6061
automatically (draw out the graph to see why)
6162

62-
6363
How to merge:
64-
- Open a GitHub PR, follow the instructions there
65-
(see [Web-Editor](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-on-github))
66-
- too large differences have to resolved locally, e.g. using the
67-
[VSCode Merge Editor](https://code.visualstudio.com/docs/sourcecontrol/overview). See
68-
[this tutorial](https://www.youtube.com/watch?v=HosPml1qkrg).
64+
65+
- Open a GitHub PR, follow the instructions there
66+
(see [Web-Editor](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-on-github))
67+
- too large differences have to resolved locally, e.g. using the
68+
[VSCode Merge Editor](https://code.visualstudio.com/docs/sourcecontrol/overview). See
69+
[this tutorial](https://www.youtube.com/watch?v=HosPml1qkrg).
6970

7071
How and when to integrate changes from the main branch?
72+
7173
- setting in Repo to suggest to 'Update branch' (you need to own the repo)
7274
- merge in changes locally using `git merge`
7375
- leave it to git and create a 'merge commit' which has two parents
@@ -76,15 +78,15 @@ How and when to integrate changes from the main branch?
7678

7779
### Add and remove large files [advanced]
7880

79-
GitHub set a limit of 100MB per file. It's a *best pratice* to only commit code and
80-
documenation, and if needed small example datasets. Adding larger files than 100MB is
81+
GitHub set a limit of 100MB per file. It's a _best pratice_ to only commit code and
82+
documenation, and if needed small example datasets. Adding larger files than 100MB is
8183
possible locally, but then the commit cannot be syncronized with the remote, hosted
8284
repository.
8385

8486
- use a large file (e.g. these ones: )
8587
- commit them in a data folder
8688
- add a few more commits (loading the files or what else)
87-
- `rebase` to remove the files again, see
89+
- `rebase` to remove the files again, see
8890
[this tutorial](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase).
8991
Options:
9092
- edit the commit where you added the large files and remove them

use_cases.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Two examples:
44

5-
- VueGen reporting tool - [VueGen repo](https://github.com/Multiomics-Analytics-Group/vuegen)
6-
- shared notes repository of Data Science Platform - [DSP notes repo](https://github.com/biosustain/dsp_notes)
7-
- publish analysis code and results ('code availability') - [not just another biomarker repo](https://github.com/RasmussenLab/njab)
5+
- VueGen reporting tool - [VueGen repo](https://github.com/Multiomics-Analytics-Group/vuegen)
6+
- shared notes repository of Data Science Platform - [DSP notes repo](https://github.com/biosustain/dsp_notes)
7+
- publish analysis code and results ('code availability') - [not just another biomarker repo](https://github.com/RasmussenLab/njab)
88

99
## Keep track of changes locally
1010

@@ -16,4 +16,3 @@ Two examples:
1616

1717
- Google Docs, Word or Overleaf is used to work collaborative on manuscripts
1818
- GitHub and git can be used to do the same on public documentation or code
19-

0 commit comments

Comments
 (0)