Skip to content

Commit 0f382ac

Browse files
authored
Merge pull request #8 from biosustain/main
push latest changes
2 parents ccabd47 + 32041c1 commit 0f382ac

19 files changed

+796
-180
lines changed

.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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
- name: Save to gh-pages
42+
uses: peaceiris/actions-gh-pages@v4
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./_build
46+
# # create a version for an PR
47+
# # will be automatically deleted in case the build in on the root
48+
destination_dir: dev

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
# Byte-compiled Python files
2+
__pycache__/
3+
4+
# data
5+
*.csv
6+
*.json
7+
*.parquet
8+
9+
# C extensions
10+
*.so
11+
12+
# Mac OS
13+
.DS_Store
14+
*/.DS_Store
15+
16+
# Distribution / packaging
17+
dist/
18+
eggs/
19+
20+
121
.npm
222
.yarn
323
.cache
@@ -9,3 +29,5 @@
929
.jupyter
1030
.bash_logout
1131
.profile
32+
.DS_Store
33+
_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: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,71 @@
1-
# Git Tutorial using
1+
# Git Tutorial
22

3-
> VS Code on Binder
4-
> VS Code on Binder, because sometimes you need a real editor.
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

6-
[![PyPI](https://img.shields.io/pypi/v/jupyter-vscode-proxy)](https://pypi.org/project/jupyter-vscode-proxy/)
7-
[![Install with conda](https://anaconda.org/conda-forge/jupyter-vscode-proxy/badges/installer/conda.svg)](https://github.com/conda-forge/jupyter-vscode-proxy-feedstock)
5+
## Announcement
86

9-
Start:
10-
- lab: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=lab)
11-
- vscode: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=vscode?folder=/home/jovyan/examples)
7+
This workshop will give you the opportunity to practice git as a version control system
8+
and Github as a website to host your repositories. Using git you can track changes in
9+
folders. It allows you track your progress and to spot random typos when working on
10+
many projects and tasks in parallel. In the workshop you will get the time to practice
11+
the fundamental concepts and actions directly in your browser - either using VSCode in
12+
GitHub Codespaces or in using the GitHub web interface. If you want, you can also try
13+
everything on your local computer.
1214

15+
I will give a brief introduction to git. Then you will specific workflows by
16+
collaboratively work on extending a [recipe book](https://biosustain.github.io/recipe-book/)
17+
(please bring a recipe you like).
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.
1322

14-
## Explore
23+
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.
1524

16-
You will need to setup your git email and user-name
17-
(replace with yours in case you want to commit something, otherwise use copy-paste)
25+
What you'll learn:
1826

19-
```bash
20-
git config --global user.email "you@example.com"
21-
git config --global user.name "Your Name"
22-
```
23-
> could be added to local config using `git config user...`
27+
- Basic tasks and actions to perform with git (in VSCode or in the browser)
28+
- How to branch and tag
29+
- Follow trunk-based development
30+
- See how to merge and comment a Pull Request based on a branch
31+
- Solve merge conflicts
32+
- Familiarize yourself with VSCode’s and GitHub’s interface and user experience
33+
- Get to know new recipes
2434

25-
### Steps
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
38+
[VSCode](https://code.visualstudio.com/) on your machine.
2639

27-
- create a folder with an empty repository (default `examples`)
28-
- `git init` in console to initialize repo
29-
- setup user.name and user.email
30-
- create files, stage them and see what files are created in `.git/objects`
31-
- commit files and check `.git/objects`
32-
- create branches and checkout `.git/refs` and `git/branches` folder
33-
- look at `git/HEAD` (maybe `git/ORIG_HEAD` if it exists)
40+
### Brief timeline of the workshop:
3441

35-
> try to create your own fork, and try to lauch it on [mybinder](https://mybinder.org/)
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 |
3649

37-
## Links
50+
## Slides
3851

52+
<iframe
53+
src="https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/embed"
54+
frameborder="0"
55+
width="100%" height="480"
56+
allowfullscreen="true"
57+
mozallowfullscreen="true"
58+
webkitallowfullscreen="true">
59+
</iframe>
60+
61+
## Local Setup
62+
63+
See [local_setup](local_setup.md) for instructions to setup git on your local computer.
64+
65+
## Links to learn more
66+
67+
- [git-intro by coderefinery](https://coderefinery.github.io/git-intro/#)
3968
- [git-moji](https://gitmoji.dev/)
40-
- [curious git](https://matthew-brett.github.io/curious-git/) - detailed intro to the inner workings
41-
- [git parable](http://practical-neuroimaging.github.io/git_parable.html) - why git came to exist
42-
- Videos:
43-
- [Python-Git-Client](https://www.youtube.com/watch?v=xvzo_nV9PjU)
44-
- [Git-Interals](https://www.youtube.com/watch?v=MYP56QJpDr4)
45-
- [Git PyData Global 2021 talk](https://www.youtube.com/watch?v=rBYC3dEOOyI)
46-
47-
## Inspect git objects
48-
49-
```bash
50-
git log --format=raw
51-
git cat-file -p <hash> # pretty print
52-
git cat-file -t <hash> # type
53-
54-
# the binary object can also be inspected using different tools,
55-
# which might make it easier to navigate to certain blobs:
56-
cat .git/objects/<2c>/<38c> | zlib-flate -uncompress
57-
```
58-
59-
## Note
60-
61-
> Should be Run the Python Tsunami notebooks on binder.
62-
?urlpath=vscode/?folder
63-
Go directly to Python Tsunami repository in
64-
- VSCode [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=vscode/?folder=/home/jovyan/PythonTsunami)
65-
- JupyterLab [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=lab/tree/PythonTsunami)
66-
- Jupyter Notebook [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=tree/PythonTsunami)
69+
- [Git Internals - Plumbing and Porcelain](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain)
70+
- [Glossary of terms for git](https://www.git-scm.com/docs/gitglossary)
71+
- [Glossary terms for GitHub](https://docs.github.com/en/get-started/learning-about-github/github-glossary)

advanced.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
# Git under the hood
3+
4+
> Extended content for those interested in how git works under the hood
5+
6+
You can find a recording of the
7+
[talk](https://www.youtube.com/watch?v=cAU3BCUkHxM)
8+
([slides](https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/edit?usp=sharing))
9+
and [hands-on tutorial](https://www.youtube.com/watch?v=5iB7qc5zRjQ)
10+
on YouTube which was done for the Data Club seminar
11+
between DTU biosustain and DTU bioengineering (see sections in description of Video).
12+
13+
Talk:
14+
[![Recording of talk](https://img.youtube.com/vi/cAU3BCUkHxM/maxresdefault.jpg)](https://www.youtube.com/watch?v=cAU3BCUkHxM)
15+
16+
Live Demo:
17+
[![Live Demo of Hands On part](https://img.youtube.com/vi/5iB7qc5zRjQ/maxresdefault.jpg)](https://www.youtube.com/watch?v=5iB7qc5zRjQ)
18+
19+
The above Live Demo is not pulling the merge commit after merging the branch on GitHub:
20+
[github.com/biosustain/git_training_henry_recording](https://github.com/biosustain/git_training_henry_recording)
21+
22+
I show the merge commit in the video below, cloining the recording repository in a newly
23+
create VSCode sandbox environment above:
24+
25+
[![Live Demo Hand on Addon](https://img.youtube.com/vi/gcfzruIJ-rw/sddefault.jpg)](https://www.youtube.com/watch?v=gcfzruIJ-rw)
26+
27+
## Instructions
28+
29+
- create a folder with an empty repository (default `examples`
30+
directly openend in VSCode on binder)
31+
- open instruction: `code-server ../README.md` (local computer: `code ../README.md`)
32+
- `git init` in console to initialize repo (or via command palette "Git: Initialize Repository")
33+
- setup user.name and user.email (see above)
34+
- create files, stage them and see what files are created in `.git/objects`
35+
- commit files and check `.git/objects`
36+
- create branches and checkout `.git/refs` (`git/branches` is a legacy folder,see
37+
[here](https://stackoverflow.com/a/10398507/9684872))
38+
- look at `git/HEAD` (maybe `git/ORIG_HEAD` if it exists)
39+
40+
> try to create your own fork, and try to lauch it on [mybinder](https://mybinder.org/)
41+
42+
## Inspect git objects
43+
44+
```bash
45+
git log --format=raw
46+
git cat-file -p <hash> # pretty print
47+
git cat-file -t <hash> # type
48+
49+
# the binary object can also be inspected using different tools,
50+
# which might make it easier to navigate to certain blobs:
51+
cat .git/objects/<2c>/<38c> | zlib-flate -uncompress
52+
```
53+
54+
You can find the latest objects and compare it to the log
55+
56+
```bash
57+
find .git/objects -type f -exec ls -lt {} + | head -n 10
58+
git log --format=raw -n 3
59+
```
60+
61+
If you wonder what the codes in a tree mean, check this stackexchange
62+
[answer](https://unix.stackexchange.com/a/450488/349761)
63+
64+
## What's happening?
65+
66+
Can you explain what happens in the following scenarios?
67+
68+
- You committed ten commits and did not yet push. Git complains about too much data.
69+
You realize that you committed your source data. You delete it and commit again,
70+
but the problem still persists.
71+
- You commit something and push. You realize your last commit was wrong. You undo it
72+
and commit again. Git complains that you cannot push.
73+
74+
## Git internals resources
75+
76+
- [curious git](https://matthew-brett.github.io/curious-git/) - detailed intro to the
77+
inner workings
78+
- [git parable](http://practical-neuroimaging.github.io/git_parable.html) - why git came to exist
79+
- Videos:
80+
- [Python-Git-Client](https://www.youtube.com/watch?v=xvzo_nV9PjU)
81+
- [Git-Interals](https://www.youtube.com/watch?v=MYP56QJpDr4) - shows how git works
82+
- [Git PyData Global 2021 talk](https://www.youtube.com/watch?v=rBYC3dEOOyI)
83+
- Scoot Chacon’s [“So you thin you know git” talk](https://www.youtube.com/watch?v=aolI_Rz0ZqY) (FOSDEM 2024),
84+
notes on [blog](https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/)

0 commit comments

Comments
 (0)