Git
Tue 9th April 2024
9.30-11.00: Intro and setup (David)
11.00-11.15: break β
11.15-12.30: Live coding exercises (Harrison)
12.30-13.30: lunch π₯ͺ
13.30-15:00: Live coding exercises (Kinzie)
15.00-15.15: break β
15.15-16.30: Final exercises & discussion (James)
Course material: https://carpentries-incubator.github.io/git-novice-branch-pr/
In-person: β in real life
Remote: β on zoom
Please wait until the end of a section
git
setuphttps://carpentries-incubator.github.io/git-novice-branch-pr/02-setup/
Perhaps
local π»
remote/distributed π
π Make changes by making a copy of the entire codebase.
π Merging is a manual process.
π¨ Lose track of which version contains what functionality.
π Collaborating is just emailing zip files and crying.
More often than not
The most important concept in git is the commit
- the name given to a unit of changes, and also to the process of making a commit.
Not actually snapshots of a file.
But can recreate a state from a sequence of changes.
https://onlywei.github.io/explain-git-with-d3
or
or
Once a directory/folder is initialised with git
it becomes a repository.
directory
.
βββ src/
βββ LICENSE.md
βββ README.md
git init
ββ->
repository
.
βββ .git/
βββ src/
βββ LICENSE.md
βββ README.md
Git generates a hash string, uniquely identifying each commit.
Git uses a βMerkle treeβ under the hood. (Donβt ask me how it works, I have no idea π€·)
Hashes look like:
d3dd03f493707256c8528bc83ad280a460f05a56
But are most often seen as the first 7 characters, as this is easier to read/type and is normally enough to identify the commit.
d3dd03f
Each commit has a message associated with it.
Summary/Title: <50-72 characters
Displayed most frequently.
Detailed description: no character limit.
Can be used to capture more detail. Not used that often.
Used to work on new features/changes/additions to the code.
Checkout: switching to a different branch.
Combine changes from two branches.
git
via unix shell (or gitbash/WSL on Windows)
Remember
Learning Git is a process.
Everyone makes mistakes.
Git
GitHub/GitLab
these slides: davidwilby.dev/git-carpentries-slides - improve this talk!