Skip to content

Commit fb2b289

Browse files
authored
Merge pull request #4 from biosustain/edition2025
edition 2025 (more basic)
2 parents c9e1636 + 2c18e67 commit fb2b289

15 files changed

Lines changed: 293 additions & 168 deletions

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
See the preview for the last modified PR:
4+
- https://biosustain.github.io/git-tutorial/dev/index.html
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Build website and save it on gh-pages branch
2+
name: build-and-save-website
3+
4+
# Only run this when the master branch is ch
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
# workflow_dispatch:
13+
14+
# This job installs dependencies, builds the website and pushes it to `gh-pages`
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-python@v5
23+
- name: Install dependencies
24+
run: |
25+
pip install -r requirements.txt
26+
27+
- name: Build the site
28+
run: |
29+
sphinx-build -nW --keep-going -b html . _build
30+
31+
# If we've pushed to main, push the book's HTML to github-pages
32+
- if: ${{ github.ref == 'refs/heads/main' }}
33+
name: Save to gh-pages
34+
uses: peaceiris/actions-gh-pages@v4
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./_build
38+
# # set it to a subfolder of the root to keep all PR previews:
39+
# destination_dir: latest
40+
# cname: website.com
41+
- if: ${{ github.ref != 'refs/heads/main' }}
42+
name: Save to gh-pages
43+
uses: peaceiris/actions-gh-pages@v4
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
publish_dir: ./_build
47+
# # create a version for an PR
48+
# # will be automatically deleted in case the build in on the root
49+
destination_dir: dev

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
.jupyter
1010
.bash_logout
1111
.profile
12+
.DS_Store
13+
_build

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2019, Tim Head
3+
Copyright (c) 2025, Henry Webel
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 83 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
1-
# Git Tutorial using
2-
3-
> VS Code on Binder
4-
> VS Code on Binder, because sometimes you need a real editor.
5-
6-
[![PyPI](https://img.shields.io/pypi/v/jupyter-vscode-proxy)](https://pypi.org/project/jupyter-vscode-proxy/)
7-
[![Install with conda](https://img.shields.io/conda/vn/conda-forge/jupyter-vscode-proxy.svg)](https://github.com/conda-forge/jupyter-vscode-proxy-feedstock)
8-
9-
Start:
10-
- lab: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/biosustain/git-tutorial/master?urlpath=lab)
11-
- vscode: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/biosustain/git-tutorial/master?urlpath=vscode?folder=/home/jovyan/examples)
12-
13-
14-
## Explore
1+
# Git Tutorial
2+
3+
## Announcement
4+
5+
This workshop will give you the opportunity to practice git as a version control system
6+
and Github as a website to host your repositories. Using git you can track changes in
7+
folders. It allows you track your progress and to spot random typos when working on
8+
many projects and tasks in parallel. In the workshop you will get the time to practice
9+
the fundamental concepts and actions directly in your browser - either using VSCode in
10+
GitHub Codespaces or in using the GitHub web interface. If you want, you can also try
11+
everything on your local computer.
12+
13+
I will give a brief introduction to git. Then you will specific workflows by
14+
collaboratively work on extending a [recipe book](https://enryh.github.io/recipe-book/).
15+
You will learn how to work on
16+
[branches](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches),
17+
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)
18+
and merge them into the main branch. If you have specific requests, feel free to reach out to me.
19+
20+
If you have specific requests, feel free to reach out to [me](mailto:heweb@dtu.dk).
21+
22+
What you'll learn:
23+
- Basic tasks and actions to perform with git (in VSCode or in the browser)
24+
- How to branch and tag
25+
- Follow trunk-based development
26+
- See how to merge and comment a Pull Request based on a branch
27+
- Solve merge conflicts
28+
- Familiarize yourself with VSCode’s and GitHub’s interface and user experience
29+
- Get to know new recipes
30+
31+
Minimal prerequisite: A [GitHub account](https://github.com/signup).
32+
If you want to follow along locally, please install
33+
[GitHub Desktop](https://desktop.github.com/download/) and
34+
[VSCode](https://code.visualstudio.com/) on your machine.
35+
36+
37+
## Explore locally
1538

1639
You will need to setup your git email and user-name
1740
(replace with yours in case you want to commit something, otherwise use copy-paste)
@@ -22,19 +45,19 @@ git config --global user.name "Your Name"
2245
```
2346
> could be added to local config using `git config user...`
2447
25-
### Steps
2648

27-
- create a folder with an empty repository (default `examples`
28-
directly openend in VSCode on binder)
29-
- open instruction: `code-server ../README.md` (local computer: `code ../README.md`)
30-
- `git init` in console to initialize repo (or via command palette "Git: Initialize Repository")
31-
- setup user.name and user.email (see above)
32-
- create files, stage them and see what files are created in `.git/objects`
33-
- commit files and check `.git/objects`
34-
- create branches and checkout `.git/refs` (`git/branches` is a legacy folder,see [here](https://stackoverflow.com/a/10398507/9684872))
35-
- look at `git/HEAD` (maybe `git/ORIG_HEAD` if it exists)
49+
## Links to learn more
3650

37-
> try to create your own fork, and try to lauch it on [mybinder](https://mybinder.org/)
51+
- [git-intro by coderefinery](https://coderefinery.github.io/git-intro/#)
52+
- [git-moji](https://gitmoji.dev/)
53+
- [Git Internals - Plumbing and Porcelain](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain)
54+
- [Glossary of terms (technical for git)](https://www.git-scm.com/docs/gitglossary)
55+
- [GitHub Glossary terms](https://docs.github.com/en/get-started/learning-about-github/github-glossary)
56+
57+
58+
## Git under the hood (Extended version)
59+
60+
> Extended content for those interested in how git works under the hood
3861
3962
You can find a recording of the
4063
[talk](https://www.youtube.com/watch?v=cAU3BCUkHxM)
@@ -60,19 +83,23 @@ create VSCode sandbox environment above:
6083
[![Live Demo Hand on Addon](https://img.youtube.com/vi/gcfzruIJ-rw/sddefault.jpg
6184
)](https://www.youtube.com/watch?v=gcfzruIJ-rw)
6285

63-
## Links
6486

65-
- [git-moji](https://gitmoji.dev/)
66-
- [curious git](https://matthew-brett.github.io/curious-git/) - detailed intro to the inner workings
67-
- [git parable](http://practical-neuroimaging.github.io/git_parable.html) - why git came to exist
68-
- Videos:
69-
- [Python-Git-Client](https://www.youtube.com/watch?v=xvzo_nV9PjU)
70-
- [Git-Interals](https://www.youtube.com/watch?v=MYP56QJpDr4) - shows how git works
71-
- [Git PyData Global 2021 talk](https://www.youtube.com/watch?v=rBYC3dEOOyI)
72-
- Scoot Chacon’s [“So you thin you know git” talk](https://www.youtube.com/watch?v=aolI_Rz0ZqY) (FOSDEM 2024),
73-
notes on [blog](https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/)
87+
### Instructions
7488

75-
## Inspect git objects
89+
- create a folder with an empty repository (default `examples`
90+
directly openend in VSCode on binder)
91+
- open instruction: `code-server ../README.md` (local computer: `code ../README.md`)
92+
- `git init` in console to initialize repo (or via command palette "Git: Initialize Repository")
93+
- setup user.name and user.email (see above)
94+
- create files, stage them and see what files are created in `.git/objects`
95+
- commit files and check `.git/objects`
96+
- create branches and checkout `.git/refs` (`git/branches` is a legacy folder,see
97+
[here](https://stackoverflow.com/a/10398507/9684872))
98+
- look at `git/HEAD` (maybe `git/ORIG_HEAD` if it exists)
99+
100+
> try to create your own fork, and try to lauch it on [mybinder](https://mybinder.org/)
101+
102+
### Inspect git objects
76103

77104
```bash
78105
git log --format=raw
@@ -95,9 +122,24 @@ If you wonder what the codes in a tree mean, check this stackexchange
95122
[answer](https://unix.stackexchange.com/a/450488/349761)
96123

97124

98-
## What's happening?
125+
### What's happening?
126+
127+
Can you explain what happens in the following scenarios?
128+
129+
- You committed ten commits and did not yet push. Git complains about too much data.
130+
You realize that you committed your source data. You delete it and commit again,
131+
but the problem still persists.
132+
- You commit something and push. You realize your last commit was wrong. You undo it
133+
and commit again. Git complains that you cannot push.
134+
135+
### Git internals resources
99136

100-
- You commited ten commits and dit not yet push. Git complains about too much data.
101-
You realize that you commited your source data. You delete it and commit again, but the problem still persists.
102-
- You commit something and push. You realize your last commit was wrong. You undo it and commit again. Git complains that
103-
you cannot push.
137+
- [curious git](https://matthew-brett.github.io/curious-git/) - detailed intro to the
138+
inner workings
139+
- [git parable](http://practical-neuroimaging.github.io/git_parable.html) - why git came to exist
140+
- Videos:
141+
- [Python-Git-Client](https://www.youtube.com/watch?v=xvzo_nV9PjU)
142+
- [Git-Interals](https://www.youtube.com/watch?v=MYP56QJpDr4) - shows how git works
143+
- [Git PyData Global 2021 talk](https://www.youtube.com/watch?v=rBYC3dEOOyI)
144+
- Scoot Chacon’s [“So you thin you know git” talk](https://www.youtube.com/watch?v=aolI_Rz0ZqY) (FOSDEM 2024),
145+
notes on [blog](https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/)

conf.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
#
7+
# created from notes_template: https://github.com/enryH/notes_template
8+
# -- Project information -----------------------------------------------------
9+
10+
project = "Git Tutorial"
11+
copyright = "2025, DTU Biosustain, Informatics Platform, DSP"
12+
author = "Henry Webel"
13+
14+
15+
# -- General configuration ---------------------------------------------------
16+
17+
18+
extensions = [
19+
"myst_nb",
20+
# "sphinx_design", # https://sphinx-design.readthedocs.io/en/sbt-theme/
21+
# "sphinx_copybutton", # https://sphinx-copybutton.readthedocs.io/
22+
"sphinx_new_tab_link",
23+
]
24+
25+
templates_path = ["_templates"]
26+
# As we can use percent notebooks and markdowns files, we need to exclude some files
27+
# additinally to the default ones (add to the list if needed)
28+
exclude_patterns = [
29+
"_build",
30+
"Thumbs.db",
31+
".DS_Store",
32+
"**/pandoc_ipynb/inputs/*",
33+
".nox/*",
34+
'.venv/*',
35+
# "README.md",
36+
"**/.ipynb_checkpoints/*",
37+
"jupyter_execute",
38+
"conf.py",
39+
"check_recipes.py",
40+
".github/PULL_REQUEST_TEMPLATE.md"
41+
]
42+
43+
44+
# -- Notebook related settings -----------------------------------------------
45+
46+
# add notebooks
47+
# https://myst-nb.readthedocs.io/en/latest/computation/execute.html
48+
nb_execution_mode = "auto"
49+
50+
myst_enable_extensions = ["dollarmath", "amsmath"]
51+
52+
# Plolty support through require javascript library
53+
# https://myst-nb.readthedocs.io/en/latest/render/interactive.html#plotly
54+
# html_js_files = [
55+
# "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"
56+
# ]
57+
58+
# https://myst-nb.readthedocs.io/en/latest/configuration.html
59+
# Execution
60+
nb_execution_raise_on_error = True
61+
# Rendering
62+
nb_merge_streams = True
63+
64+
# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats
65+
nb_custom_formats = {
66+
# ".py": ["jupytext.reads", {"fmt": "py:percent"}]
67+
}
68+
69+
70+
# -- Options for HTML output -------------------------------------------------
71+
72+
# 2. Select a tempalate
73+
# ! you might need additional dependencies in requirements.txt
74+
# browse available themes: https://sphinx-themes.org/
75+
76+
77+
# The theme to use for HTML and HTML Help pages. See the documentation for
78+
# a list of builtin themes.
79+
# See:
80+
# https://github.com/executablebooks/MyST-NB/blob/master/docs/conf.py
81+
# html_title = ""
82+
html_theme = "sphinx_book_theme"
83+
# html_theme = "sphinx_book_theme" # alternative
84+
# html_logo = "_static/logo-wide.svg"
85+
# html_favicon = "_static/logo-square.svg"
86+
html_theme_options = {
87+
"github_url": "https://github.com/biosustain/git-tutorial",
88+
"repository_url": "https://github.com/biosustain/git-tutorial",
89+
# "repository_branch": "main",
90+
"home_page_in_toc": True,
91+
# "path_to_docs": "docs",
92+
"show_navbar_depth": 1,
93+
# "use_edit_page_button": True,
94+
"use_repository_button": True,
95+
"use_download_button": True,
96+
"launch_buttons": {
97+
"colab_url": "https://colab.research.google.com"
98+
# "binderhub_url": "https://mybinder.org",
99+
# "notebook_interface": "jupyterlab",
100+
},
101+
"navigation_with_keys": False,
102+
}
103+
# Add any paths that contain custom static files (such as style sheets) here,
104+
# relative to this directory. They are copied after the builtin static files,
105+
# so a file named "default.css" will overwrite the builtin "default.css".
106+
# html_static_path = ['_static']

environment.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
```{include} README.md
2+
```
3+
4+
5+
```{toctree}
6+
:maxdepth: 1
7+
:hidden:
8+
9+
instructions_251105
10+
instructions_241113
11+
12+
13+
```

instructions_241113.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
.. at DTU biosustain and DTU bioengineering.
44

5+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=874029589&skip_quickstart=true)
6+
57
## Plan
68

79
- Introduction to git ([slides](https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/edit?usp=sharing)),

instructions_251105.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Workshop on the 5th of November 2025
2+
3+
> to be continued.
4+
5+
## How to work with the repository
6+
7+
You need to be logged in to GitHub and have a GitHub account for all these options:
8+
[Create a GitHub account](https://github.com/join)
9+
10+
### On the GitHub website
11+
12+
- Create a fork of the repository and work there
13+
14+
### In VSCode in the browser without a workspace
15+
16+
You need to be logged in to GitHub and have a GitHub account.
17+
18+
- [github.dev/enryH/recipe-book](https://github.dev/enryH/recipe-book)
19+
20+
### In GitHub Workspace
21+
22+
- Open in GitHub Codespace if you want to build and preview the website without
23+
creating a commit:
24+
25+
[![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)
26+
27+

0 commit comments

Comments
 (0)