Large repositories: submodules, worktrees, LFS and signing
You learn to cope with growing repositories, use several working trees and prove where commits come from by signing them.
Level 301 · 15 lessons · 12 practice labs
Lessons
Combining and splitting repositories
- Submodules: adding, updating, pinning
- Pulling another repository in with subtree
- Splitting a folder into its own repository with history
- Short task: link a shared library at a fixed version into two projects
Speed and size
- Several branches at once with worktrees
- Shallow and partial clones
- Only the folders you need with sparse-checkout
- Large files with Git LFS
- Purging big files and leaked data from history
- Short task: shrink a bloated repository and have the team re-clone
Provenance and trust
- Signing commits and tags with GPG
- Signing with SSH keys and allowed_signers
- Verifying signatures and rejecting unsigned changes
- Short task: publish and verify a signed release tag
Wrap-up
- Capstone: make a multi-part project fast and signed
Practice labs
- Pin a submodule to a release: Update the shared library submodule to the given release tag, commit that pin in the main repository and show a fresh clone gets the same version.
- A submodule that moved: Update .gitmodules for the submodule whose address changed, sync the local configuration and prove everything, nested submodules included, now comes from the new address.
- From submodule to subtree: Bring a submodule that keeps causing the team trouble into the main repository as a subtree with its history, clean up .gitmodules leftovers and show the library’s history is visible.
- A hotfix while the build runs: Make the urgent fix in a separate worktree without touching your main working copy, commit it and show with git worktree list that you removed it cleanly afterwards.
- Split a folder with its history: Split Ekin Co-op’s reporting folder into a new repository with its history and show the new repository only contains commits that touched that folder.
- Worktrees deleted by hand: Repair the branches that report ‘already checked out’ because worktree folders were moved or deleted by hand, and prove the remaining worktrees point at the right paths.
- Only the folders you need: Set up sparse-checkout in a large repository so only the docs and one service folder are visible, and report the working-tree file count before and after.
- Move design files to LFS: Move large design and video files already in history to Git LFS across all of history and show the repository now holds only pointer files.
- Missing history in a shallow clone: Explain why git describe and finding a merge base fail in a shallow clone, deepen the history only as much as needed and show both commands now work.
- A commit signed with an SSH key: Set up your SSH key and an allowed_signers file for commit signing, make a signed commit and show with verify-commit that the signature is valid.
- Find the unsigned commits: List the unsigned or unverifiable commits on Pinecrest Bank’s release branch using log format codes, and report the author and status of each.
- A release tag that won’t verify: Find why the release tag fails verification (wrong key, missing trust entry or an expired key), fix the trust setup and re-sign the tag with the right key.
About this course
You learn to cope with growing repositories, use several working trees and prove where commits come from by signing them.
What you will learn
- Combining and splitting repositories
- Speed and size
- Provenance and trust
- Wrap-up
Prerequisites
You should be comfortable with the level 101 and 201 topics of the same path.
Lab environment
Lessons run in your own Kali Linux terminal that opens in the browser. Nothing to install; the lab starts clean in every lesson.
Frequently asked questions
- Is this course right for my level?
- The course is at level 301; it assumes you know the topics of the lower-level courses.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.