Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
65187e3
:art: move links to biosustain fork
enryH Oct 22, 2024
db1a071
:memo: update instructions
enryH Oct 22, 2024
661c581
:bug: remove code box (floating around)
enryH Oct 23, 2024
f00f903
:art: remove old hints
enryH Oct 23, 2024
a6060b0
:memo: add Live Demo Recording
enryH Oct 28, 2024
5379af6
:memo: instruction for the 2h workshop
enryH Nov 8, 2024
66b048b
:memo: Add slides and recording of talk to README
enryH Nov 8, 2024
2de2cf1
:memo: add links to recordings of talk, add live demo addon recording…
enryH Nov 11, 2024
af06aac
:memo: add links of recording of talk
enryH Nov 11, 2024
c3f2b8f
:bug: update links and instructions
enryH Nov 11, 2024
9bcac1a
:memo: more hints on instructions
enryH Nov 12, 2024
ef42df6
:memo: add collaborator access instructions
enryH Nov 12, 2024
c9e1636
:memo: link follow up recording
enryH Nov 14, 2024
37cede3
:memo: add more resources, especially coderefinery material
enryH Sep 23, 2025
782e402
♻️ Restructure README
enryH Sep 23, 2025
d1d0c7f
🙈 hide MAC OS files
enryH Sep 23, 2025
aeef451
:art: link recipe book
enryH Sep 23, 2025
1e86aa4
:sparkles: add website for course
enryH Sep 23, 2025
3e5711b
:art: Add hint to dev version of website
enryH Sep 23, 2025
34baa51
:memo: update instruction for 2025
enryH Sep 23, 2025
55b5df4
:memo: improve announcement
enryH Sep 25, 2025
09f31b0
:fire: no more binder, just open in codespace for advanced testing (m…
enryH Sep 25, 2025
2c18e67
:art: add entry in sidebar of landing page
enryH Sep 25, 2025
fb2b289
Merge pull request #4 from biosustain/edition2025
enryH Sep 25, 2025
f4b06a9
:memo: add sign-up form and timetable to the landing page
enryH Sep 25, 2025
d3396c9
:memo: last adaptions
enryH Sep 25, 2025
fd5f141
:memo: add the example to .gitignore
enryH Sep 30, 2025
7d9f86f
:construction: start addind exercises
enryH Oct 29, 2025
a09464f
🚧 start drafting exercises
enryH Oct 29, 2025
eece448
🔧 just go live for now also from PR
enryH Oct 29, 2025
4867b9b
:art: remember to find preview under dev
enryH Oct 29, 2025
24a569c
:art: add slides to website
enryH Oct 30, 2025
d99c7dd
:wrench: move content around
enryH Oct 30, 2025
b91f8ba
:memo: add more links to contents and correct typos
enryH Oct 30, 2025
aa559b1
:art: format
enryH Oct 30, 2025
885e9a0
:memo: preview receipe website and add hints on building it
enryH Oct 30, 2025
61e9276
🚚 move advanced content out of Readme to it's own page
enryH Oct 30, 2025
8e9d741
Merge pull request #6 from biosustain/updates
enryH Oct 30, 2025
443040e
Incl feedback (#7)
enryH Nov 4, 2025
a6872df
:memo: use biosustain org for recipe book
enryH Nov 5, 2025
68f9766
✨ add video link
enryH Nov 5, 2025
216f210
:art: use embed video
enryH Nov 5, 2025
271a713
:art: set link directly to biosustain/recipe-book
enryH Nov 5, 2025
d0b8bb0
Merge pull request #8 from biosustain/last_links
enryH Nov 5, 2025
322ed74
:bug: fix link
enryH Nov 5, 2025
32041c1
Update based course experiences (#9)
enryH Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


See the preview for the last modified PR:
- https://biosustain.github.io/git-tutorial/dev/index.html
48 changes: 48 additions & 0 deletions .github/workflows/build_website.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Build website and save it on gh-pages branch
name: build-and-save-website

# Only run this when the master branch is ch
on:
push:
branches:
- main
pull_request:
branches:
- main
# workflow_dispatch:

# This job installs dependencies, builds the website and pushes it to `gh-pages`
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
pip install -r requirements.txt

- name: Build the site
run: |
sphinx-build -nW --keep-going -b html . _build

# If we've pushed to main, push the book's HTML to github-pages
- if: ${{ github.ref == 'refs/heads/main' }}
name: Save to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build
# # set it to a subfolder of the root to keep all PR previews:
# destination_dir: latest
# cname: website.com
- name: Save to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build
# # create a version for an PR
# # will be automatically deleted in case the build in on the root
destination_dir: dev
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Byte-compiled Python files
__pycache__/

# data
*.csv
*.json
*.parquet

# C extensions
*.so

# Mac OS
.DS_Store
*/.DS_Store

# Distribution / packaging
dist/
eggs/


.npm
.yarn
.cache
Expand All @@ -9,3 +29,5 @@
.jupyter
.bash_logout
.profile
.DS_Store
_build
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2019, Tim Head
Copyright (c) 2025, Henry Webel
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
111 changes: 58 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,71 @@
# Git Tutorial using
# Git Tutorial

> VS Code on Binder
> VS Code on Binder, because sometimes you need a real editor.
Sign-Up to the workshop here (being logged in with your DTU Microsoft account): [Sign-Up Form](https://forms.office.com/e/62H1nV61R0)

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

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

I will give a brief introduction to git. Then you will specific workflows by
collaboratively work on extending a [recipe book](https://biosustain.github.io/recipe-book/)
(please bring a recipe you like).
You will learn how to work on
[branches](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches),
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)
and merge them into the main branch. If you have specific requests, feel free to reach out to me.

## Explore
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.

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

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

### Steps
Minimal prerequisite: A [GitHub account](https://github.com/signup).
If you want to follow along locally, please install
[GitHub Desktop](https://desktop.github.com/download/) and
[VSCode](https://code.visualstudio.com/) on your machine.

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

> try to create your own fork, and try to lauch it on [mybinder](https://mybinder.org/)
| Time | Activity |
| ------------- | ------------------------------------------ |
| 10:00 - 10:15 | Coffee and snacks 🥐 |
| 10:15 - 10:45 | Introduction and example workflow |
| 10:45 - 12:00 | Working collaboratively on the recipe book |
| 12:00 - 12:30 | lunch break (not included) |
| 12:30 - 13:30 | Your question and advanced content |

## Links
## Slides

<iframe
src="https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/embed"
frameborder="0"
width="100%" height="480"
allowfullscreen="true"
mozallowfullscreen="true"
webkitallowfullscreen="true">
</iframe>

## Local Setup

See [local_setup](local_setup.md) for instructions to setup git on your local computer.

## Links to learn more

- [git-intro by coderefinery](https://coderefinery.github.io/git-intro/#)
- [git-moji](https://gitmoji.dev/)
- [curious git](https://matthew-brett.github.io/curious-git/) - detailed intro to the inner workings
- [git parable](http://practical-neuroimaging.github.io/git_parable.html) - why git came to exist
- Videos:
- [Python-Git-Client](https://www.youtube.com/watch?v=xvzo_nV9PjU)
- [Git-Interals](https://www.youtube.com/watch?v=MYP56QJpDr4)
- [Git PyData Global 2021 talk](https://www.youtube.com/watch?v=rBYC3dEOOyI)

## Inspect git objects

```bash
git log --format=raw
git cat-file -p <hash> # pretty print
git cat-file -t <hash> # type

# the binary object can also be inspected using different tools,
# which might make it easier to navigate to certain blobs:
cat .git/objects/<2c>/<38c> | zlib-flate -uncompress
```

## Note

> Should be Run the Python Tsunami notebooks on binder.
?urlpath=vscode/?folder
Go directly to Python Tsunami repository in
- VSCode [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=vscode/?folder=/home/jovyan/PythonTsunami)
- JupyterLab [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=lab/tree/PythonTsunami)
- Jupyter Notebook [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RasmussenLab/git-tutorial/master?urlpath=tree/PythonTsunami)
- [Git Internals - Plumbing and Porcelain](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain)
- [Glossary of terms for git](https://www.git-scm.com/docs/gitglossary)
- [Glossary terms for GitHub](https://docs.github.com/en/get-started/learning-about-github/github-glossary)
84 changes: 84 additions & 0 deletions advanced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

# Git under the hood

> Extended content for those interested in how git works under the hood

You can find a recording of the
[talk](https://www.youtube.com/watch?v=cAU3BCUkHxM)
([slides](https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/edit?usp=sharing))
and [hands-on tutorial](https://www.youtube.com/watch?v=5iB7qc5zRjQ)
on YouTube which was done for the Data Club seminar
between DTU biosustain and DTU bioengineering (see sections in description of Video).

Talk:
[![Recording of talk](https://img.youtube.com/vi/cAU3BCUkHxM/maxresdefault.jpg)](https://www.youtube.com/watch?v=cAU3BCUkHxM)

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

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

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

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

## Instructions

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

> try to create your own fork, and try to lauch it on [mybinder](https://mybinder.org/)

## Inspect git objects

```bash
git log --format=raw
git cat-file -p <hash> # pretty print
git cat-file -t <hash> # type

# the binary object can also be inspected using different tools,
# which might make it easier to navigate to certain blobs:
cat .git/objects/<2c>/<38c> | zlib-flate -uncompress
```

You can find the latest objects and compare it to the log

```bash
find .git/objects -type f -exec ls -lt {} + | head -n 10
git log --format=raw -n 3
```

If you wonder what the codes in a tree mean, check this stackexchange
[answer](https://unix.stackexchange.com/a/450488/349761)

## What's happening?

Can you explain what happens in the following scenarios?

- You committed ten commits and did not yet push. Git complains about too much data.
You realize that you committed your source data. You delete it and commit again,
but the problem still persists.
- You commit something and push. You realize your last commit was wrong. You undo it
and commit again. Git complains that you cannot push.

## Git internals resources

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