VS Code on Binder
VS Code on Binder, because sometimes you need a real editor.
Start:
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)
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...
- 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) - look at
git/HEAD
(maybegit/ORIG_HEAD
if it exists)
try to create your own fork, and try to lauch it on mybinder
You can find a recording of the talk (slides) and hands-on tutorial on YouTube which was done for the Data Club seminar between DTU biosustain and DTU bioengineering (see sections in description of Video).
The above Live Demo is not pulling the merge commit after merging the branch on GitHub: 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:
- git-moji
- curious git - detailed intro to the inner workings
- git parable - why git came to exist
- Videos:
- Python-Git-Client
- Git-Interals - shows how git works
- Git PyData Global 2021 talk
- Scoot Chacon’s “So you thin you know git” talk (FOSDEM 2024), notes on blog
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
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
- You commited ten commits and dit not yet push. Git complains about too much data. You realize that you commited 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.