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
1639You 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
3962You 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
78105git 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/ )
0 commit comments