Skip to content

Commit 443040e

Browse files
authored
Incl feedback (#7)
* 📝 add rebase and large file instructions * 📝 add error message for large file and provide one example * 📝 add links from email * 📝 add more hints on interactive rebasing * 📝 git interactive w.r.t to main branch * 🐛 fix which slide is shown * 🐛 do not try to highlight terminal block * 📝 be more specific with basic exercise * 🎨 move recording instructions * 🎨 typos and deleting comments
1 parent 8e9d741 commit 443040e

File tree

2 files changed

+146
-15
lines changed

2 files changed

+146
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ If you want to follow along locally, please install
5050
## Slides
5151

5252
<iframe
53-
src="https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/embed?slide=id.p#slide=id.p"
53+
src="https://docs.google.com/presentation/d/1RsKMiKquE4wqncrAv9LEtjivGE_dGiHoJ8nKCxgVKeY/embed"
5454
frameborder="0"
5555
width="100%" height="480"
5656
allowfullscreen="true"

instructions_251105.md

Lines changed: 145 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
# Workshop on the 5th of November 2025
22

3-
> to be continued.
3+
44

55
## How to work with the repository
66

77
You need to be logged in to GitHub and have a GitHub account for all these options:
88
[Create a GitHub account](https://github.com/join)
99

10-
> ToDo: Make brief video for preperations and as reference
10+
11+
These information might be helpful:
12+
13+
- basic Markdown syntax: [Mastering Markdown](https://guides.github.com/features/mastering-markdown/)
14+
15+
We will by default be using VS Code in the Browser with a GitHub Codespace connected.
16+
Please have a look at the (video) tutorials before the course:
17+
- VSCode in the Browser: [vscode-web](https://code.visualstudio.com/docs/setup/vscode-web)
18+
( we will connect a remote machine using a codespace)
19+
- Codespaces: [codespaces/quickstart](https://docs.github.com/en/codespaces/quickstart)
1120

1221
### On the GitHub website
1322

14-
- Create a fork of the repository and work there
23+
- [Create a fork](https://github.com/biosustain/recipe-book/fork)
24+
of the repository and work there
1525

1626
### In VSCode in the browser without a workspace
1727

@@ -34,22 +44,27 @@ and the command line program [git](https://git-scm.com/install/)
3444

3545
## Exercises
3646

37-
Choose your favrioute.
47+
Choose your favourite. We will focus on the basic one, but you can try the others
48+
as well or instead. Find exercise groups seeing the marks on the tables.
3849

3950
### Add your recipe and request a review [basic]
4051

41-
> This I have to test with someone
42-
43-
- [create a fork](https://github.com/enryH/recipe-book/fork)
52+
- [create a fork](https://github.com/biosustain/recipe-book/fork)
4453
(or request access as collaborator of the the recipe-repo)
45-
- add and commit your recipe. The next two steps can be done either as first or
46-
second, why?
47-
- create a branch with your new recipe, e.g. `add-aioli-pasta`
48-
- create a commit with your new recipe draft
54+
- create a new branch from `main`, e.g. `add-aioli-pasta`
55+
- create a commit with your new recipe draft
4956
- open a Pull (Merge) Request on GitHub to `origin/main`
5057
- ask someone (by inviting them) to review your PR and get an approval
5158
- I set-up the repo to require at least one approval before a merge is possible
5259
(best-practice)
60+
- merge the PR into `main` (you can do it yourself after getting the approval)
61+
- check out your options (merge, squash, rebase) and choose one
62+
- syncronize your branch with `main` with `origin/main` (before adding a new recipe)
63+
64+
<details>
65+
<summary>See full pass through exercise</summary>
66+
> ToDo: Make brief video for preperations and as reference
67+
</details>
5368
5469
### Create a merge conflict [medium]
5570

@@ -64,28 +79,136 @@ How to merge:
6479

6580
- Open a GitHub PR, follow the instructions there
6681
(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
82+
- too large differences have to be resolved locally, e.g. using the
6883
[VSCode Merge Editor](https://code.visualstudio.com/docs/sourcecontrol/overview). See
6984
[this tutorial](https://www.youtube.com/watch?v=HosPml1qkrg).
7085

7186
How and when to integrate changes from the main branch?
7287

73-
- setting in Repo to suggest to 'Update branch' (you need to own the repo)
88+
- setting in repository on GitHub to suggest to 'Update branch' (you need to own the repo)
7489
- merge in changes locally using `git merge`
7590
- leave it to git and create a 'merge commit' which has two parents
7691

7792
### Rewrite history [advanced]
7893

94+
> You can do this on your own repository or the recipe-book repo on a branch.
95+
96+
- add a few more commits (loading the files or what else)
97+
- `rebase interactive` to remove the files again, see
98+
[this tutorial](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase).
99+
Please make sure you understand one of it's main comments:
100+
> "It's very important to understand that even though the branch looks the same,
101+
> it's composed of entirely new commits."
102+
- edit, squash, delete or reorder commits
103+
104+
Try an interactive rebase to rewrite history. To edit the last 4 commits, use:
105+
106+
```bash
107+
git rebase -i HEAD~4
108+
```
109+
or with respect to the `main` branch:
110+
```bash
111+
git rebase -i main
112+
```
113+
114+
All the instructions will be visable to you in your default editor. Try to follow them
115+
using the help of the linked tutorial.
116+
117+
<details>
118+
<summary>What is an interactive rebase?</summary>
119+
120+
An Interactive rebase is a Git command that allows you to edit, reorder, squash,
121+
or delete commits in your branch's history. This is useful for cleaning up your commit
122+
history before merging changes, combining related commits, or removing mistakes.
123+
124+
Common actions during interactive rebase:
125+
- `pick`: Use the commit as is.
126+
- `reword`: Edit the commit message.
127+
- `edit`: Pause to amend the commit.
128+
- `squash`: Combine this commit with the previous one.
129+
- `drop`: Remove the commit.
130+
131+
It will look something similar to this (taken from the tutorial linked above):
132+
133+
```bash
134+
pick 2231360 some old commit
135+
pick ee2adc2 Adds new feature
136+
137+
138+
# Rebase 2cf755d..ee2adc2 onto 2cf755d (9 commands)
139+
#
140+
# Commands:
141+
# p, pick = use commit
142+
# r, reword = use commit, but edit the commit message
143+
# e, edit = use commit, but stop for amending
144+
# s, squash = use commit, but meld into previous commit
145+
# f, fixup = like "squash", but discard this commit's log message
146+
# x, exec = run command (the rest of the line) using shell
147+
# d, drop = remove commit
148+
```
149+
150+
workflow:
151+
1. Run `git rebase -i HEAD~4` to open the last 4 commits in your editor.
152+
2. Change the action keywords as needed.
153+
3. Save and close the editor to apply changes.
154+
4. Resolve any conflicts if prompted.
155+
156+
> Interactive rebase rewrites commit history. Only use it on branches that haven't
157+
been shared with others, or coordinate closely with collaborators to avoid confusion.
158+
159+
</details>
160+
79161
### Add and remove large files [advanced]
80162

81163
GitHub set a limit of 100MB per file. It's a _best pratice_ to only commit code and
82164
documenation, and if needed small example datasets. Adding larger files than 100MB is
83165
possible locally, but then the commit cannot be syncronized with the remote, hosted
84166
repository.
85167

86-
- use a large file (e.g. these ones: )
168+
- use a large file generating some random large files (e.g. this
169+
[one](https://drive.google.com/drive/folders/1xvYoWVzzgU1mGCG07tvv6V03mR7meC1Q?usp=sharing
170+
I created running the Python code below):
171+
172+
```python
173+
import numpy as np
174+
alphabet = np.array(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
175+
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],
176+
dtype='<U1')
177+
mb = 1024*1024
178+
n = 105*mb # number of random characters to get >100MB so GitHub rejects it
179+
np.random.choice(np.fromstring(alphabet, dtype='<U1'), n)
180+
```
181+
87182
- commit them in a data folder
88183
- add a few more commits (loading the files or what else)
184+
- try to push the changes to GitHub, it will fail
185+
<details>
186+
<summary>See error you will encounter uploading large files</summary>
187+
188+
I added two commits, where the older one (the first one) contains a large file:
189+
190+
```
191+
heweb@nnfcb-l1106 recipe-book % git push
192+
Enumerating objects: 9, done.
193+
Counting objects: 100% (9/9), done.
194+
Delta compression using up to 11 threads
195+
Compressing objects: 100% (7/7), done.
196+
Writing objects: 100% (7/7), 66.75 MiB | 31.34 MiB/s, done.
197+
Total 7 (delta 2), reused 0 (delta 0), pack-reused 0
198+
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
199+
remote: error: Trace: cb745b39bf3e1c2e15b6a344ef0eb8c2610555ec1fb16bb2773facc475e525be
200+
remote: error: See https://gh.io/lfs for more information.
201+
remote: error: File large_text_file.txt is 105.00 MB; this exceeds GitHub's file size limit of 100.00 MB
202+
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
203+
To https://github.com/enryH/recipe-book.git
204+
! [remote rejected] test-lfs -> test-lfs (pre-receive hook declined)
205+
error: failed to push some refs to 'https://github.com/enryH/recipe-book.git'
206+
```
207+
208+
As of now git has a built-in support for hinting you at which files are to large to be
209+
uploaded to GitHub.
210+
</details>
211+
89212
- `rebase` to remove the files again, see
90213
[this tutorial](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase).
91214
Options:
@@ -95,3 +218,11 @@ repository.
95218
> Please not that files synchronized once to GitHub stay there 'forever'. If you update
96219
> your history (your commits) they are lost by being not referenced anywhere, but anyone
97220
> who knows the commit-id and has access can in princple find them again
221+
222+
#### How does it happen in practice?
223+
224+
- data is commited, but not every commit is synced to the remote
225+
- long notebooks with outputs are commited, making it very large text files (espe
226+
with interactive plots)
227+
228+
> so check for large individual files if you cannot push your changes

0 commit comments

Comments
 (0)