Skip to content

Git Beyond the Basics

Glossary

105 terms from Git Beyond the Basics, in plain words, each with the chapter that teaches it.

#

--ff-only
An option that makes a pull or merge succeed only if it can fast-forward, and otherwise stop. Rebase then `--ff-only` merge gives a straight line.
--follow-tags
A `git push` option that pushes your branch plus any annotated tags on the commits being pushed. A plain `git push` sends no tags.
--force-with-lease
A safer force push that replaces the remote branch only if it is still where your last fetch saw it. If a teammate pushed meanwhile, Git rejects it with `stale info`.
--no-ff
A `git merge` option that always makes a merge commit, even when a fast-forward was possible, so the branch stays visible in history.
--no-verify
Skips the pre-commit and commit-msg hooks for one commit. Use it only for a change you've checked yourself.

A

annotated tag
A tag that is an object of its own, storing who made it, when and a message. Sam uses annotated tags such as v1.1.0 to mark Kettle & Crane releases.
autosquash (--autosquash)
An option for `git rebase -i` that moves each `fixup!` commit under the commit it fixes and marks it `fixup` for you. Priya only has to save the to-do list.

B

bare repository
A repository that holds only the history, with no working files to edit. GitHub keeps one, and `shop.git` stands in for it in the practice team.
base
The commit a branch started from. Jo's branch had base 76564d9 until she rebased it onto newer main commits.
bisect
A binary search through history: Git checks out the middle commit, you say whether the bug is there, and each answer halves the suspects until one commit is left.
bisect run
Makes `git bisect` test each commit automatically by running your script. Exit status 0 marks the commit good, 125 skips it and other values from 1 to 127 mark it bad.
blame
Shows, line by line, which commit and author last changed each line of a file. Sam uses it to see who changed the shipping rate in ship.py.
branching strategy
A team's agreement about which branches exist, how long they live and how work reaches main. Kettle & Crane chose GitHub flow.

C

character class
A pattern piece in square brackets that matches any one character from a set. `[0-9]` matches one digit, which the price check uses.
cherry-pick
Copies one commit's change onto the current branch as a new commit. Sam uses it to put the Oregon rate fix on release/1.1 without the README change.
chmod +x
Gives a file permission to run as a program. A hook file must have it or Git can't run it.
CI/CD (continuous integration and delivery)
Automation that runs checks, tests and releases on a server such as GitHub whenever code is pushed or a pull request is opened. It is the place for checks that must always hold before changes are merged or shipped.
CODEOWNERS
A GitHub file, `.github/CODEOWNERS`, naming who must review changes to which files. The last matching line wins.
combined diff
The diff Git shows during a conflict, with one column of + and - for each side. Jo reads it with `git diff` before editing.
command substitution
Writing `$(command)` puts that command's output in its place, so `files=$(ls)` stores the file list in a variable.
cone mode
The default mode of sparse checkout, which works on whole folders and always keeps top-level files such as README.md.
conflict markers
Lines Git writes into a file to show where two sides' changes clash. They must be edited out before committing.
core.hooksPath
A Git setting that points Git at a different folder for hooks. Setting it to `.githooks` lets the team share hooks through the repository.
CRLF (Windows line endings)
The line-ending style used on Windows. A hook saved with it fails with `bad interpreter: bash^M` and must be converted to LF.

D

detached HEAD
A state where HEAD points straight at a commit instead of a branch. It is fine for looking and testing, but new commits would belong to no branch.
diverged
Two histories have diverged when each has commits the other lacks, so a fast-forward isn't possible.
draft pull request
A pull request visible to everyone but not mergeable, and asking for no review yet. You click Ready for review when it's finished.

E

error stream
Where programs print error messages, kept separate from normal output. In hooks, `echo "text" >&2` writes there.
exit status
A command's result: 0 means success and anything else means failure. The shell keeps the last one in `$?`, and Git uses it to decide whether a hook or bisect test passed.

F

fast-forward
A merge or pull where Git just moves a branch pointer forward because nothing diverged, creating no merge commit.
feature flag
A setting that keeps new code switched off until it's ready, so unfinished work can be merged without a long-lived branch.
fixup commit
A commit made with `git commit --fixup=target` and marked to be folded into an earlier commit later by autosquash. Priya uses one to fix the FAQ title.
force push
A push that replaces the remote branch's history with yours. It is needed after rebasing a pushed branch.
fork
Your own copy of a repository on GitHub, which you can push to. People who can't push to Kettle & Crane's repository open pull requests from a fork.

G

garbage collection
Git's occasional cleanup that deletes commits nothing points to any more. After it runs, even the reflog can't bring them back.
gh (GitHub CLI)
GitHub's command-line tool, used for things like `gh pr checkout 14` and `gh release create`.
git config
Reads and sets Git settings. Without `--global` a setting applies to the current repository only, and with no value it prints the setting.
git describe
Names the current commit after the nearest annotated tag, such as `v1.1.0-1-g5636763`: that tag plus 1 commit, at commit 5636763.
git diff --cached
Shows what is staged, meaning what the next commit would add. Pre-commit hooks use it to inspect a commit before it's made.
git filter-repo
A tool that removes a file, such as a leaked password, from all of history. You must change the password too.
Git flow
A branching strategy with `develop`, `release/` and `hotfix/` branches, suited to software shipped as numbered versions.
Git LFS
A tool that keeps large files such as photos outside the repository itself.
git revert
Undoes a commit by making a new commit that reverses it, leaving history intact. For a merge already on shared main, use `git revert -m 1 HASH`.
git shortlog
Groups commit summaries by author. Run over a tag range, such as `git shortlog v1.0.0..v1.1.0`, it gives raw material for release notes.
GitHub flow
A branching strategy of one short branch per change, merged through a pull request, with main always ready to go live. Kettle & Crane uses it.
GitHub release
A page on GitHub built on a tag, with release notes and optional downloads.
golden rule
Never rebase commits that other people already have, or the same changes appear twice when histories meet.
grep
A command that searches text for lines matching a pattern. It succeeds if it finds a match, `-q` prints nothing, `-v` keeps non-matching lines and `-c` counts matches.

H

hash
The long code that uniquely identifies a commit, usually shown shortened, like `76564d9`. Because it is computed from the commit's contents and its parent, rebasing a commit gives it a new hash, and the same change made in different clones can have different hashes.
HEAD
Git's pointer to the commit you are currently on, normally via a branch name.
HEAD@{n}
A reflog name meaning where HEAD (or a named branch) was n moves ago. The numbers shift with every move, so check with `git reflog`.
HEAD~N
The commit N steps before HEAD on the same line of history. Unlike a hash, it is the same for every reader.
hook
A script Git runs at a set moment, such as before a commit. If it exits with a non-zero status, Git stops.
hotfix
A quick fix to a version that is already live. In Git flow, `hotfix/` branches hold these fixes, and a hotfix can be shipped by cherry-picking the fix onto a release branch.

I

interactive rebase
A rebase that first opens a to-do list so you can reword, combine, drop, reorder or split commits before review.
issue
GitHub's numbered to-do item for a bug or request. Writing `Fixes #12` in a pull request closes issue 12 on merge.

L

lightweight tag
A tag that just attaches a name to a commit, with no tagger, date or message of its own. Annotated tags are preferred for releases because they record who made them and when.
linear history
One straight line of commits with no merge commits, easy to read but produced by rewriting commits with rebase.
long-lived and short-lived branches
A short-lived branch lasts hours or days; a long-lived one lasts weeks or forever, like `develop`. The longer a branch lives, the bigger its conflicts.

M

mainline parent
A merge commit's first parent, the branch you merged into. `git revert -m 1` keeps it when undoing a merge already on shared main.
merge base
The last commit two branches share, where both sides started. Showing it inside conflicts helps you see what each side changed.
merge commit
A commit with two parents that joins two branches' histories. `git merge --no-ff` always makes one, and a rebase avoids them.
merge queue
A GitHub feature that merges approved pull requests one at a time.
modify/delete conflict
A conflict where one side changed a file the other side deleted. You settle it with `git rm` to delete or `git add` to keep.
monorepo
A monorepo holds many projects in one repository, one folder each; a polyrepo setup gives each project its own repository.

O

objects
What Git stores: commits, folder listings and file versions. `git count-objects -v` reports how many a clone holds.
ORIG_HEAD
Where HEAD was before the last reset, merge or rebase. `git reset --hard ORIG_HEAD` undoes it before you push, but the next such command overwrites it.
ours and theirs
The two sides of a conflict. In a merge, ours is your branch; in a rebase they swap, so ours is the branch you build on and theirs is your own replayed commit.

P

pathspec
The paths after `--` that limit a command like `git log` to some files or folders, such as `-- api/`.
pattern characters
Special characters in grep patterns: `^` start of line, `$` end of line, `.` any character, `*` any number of the previous item and `\.` a real dot.
pickaxe search
`git log -S 'text'` lists the commits that added or removed that text, such as the bad 0.95 in ship.py.
practice team
The folder `~/team` built by `setup.sh`, with a shared `shop.git` and a clone for each teammate, so you can practice teamwork on one computer.
pre-commit
Three hook names: pre-commit runs before a commit and can inspect what's staged, commit-msg runs after you write the message, and pre-push runs before a push.
prune (fetch --prune)
Removes remote-tracking branches whose branch was deleted on the remote, tidying your local list.
pull request
A GitHub page that proposes merging one branch into another, where teammates review, comment and approve before it is merged. Kettle & Crane sends every change through one.
pull request template
A Markdown file in `.github/` that GitHub copies into every new pull request's description box.

R

range-diff
Compares two versions of a series of commits, such as before and after a force-push. `=` means unchanged, `!` means changed.
rebase
Replays a branch's commits on top of another commit, making new commits with new hashes and a linear history.
reflog
Your clone's local diary of where HEAD and each branch have pointed, used to find commits that seem lost. It isn't pushed or cloned.
release branch
A branch kept for fixes to one released version. Sam makes release/1.1 from the v1.1.0 tag for the hotfix.
remote-tracking branch
Your copy of a branch on the remote, like `origin/main`, recording where it was at your last fetch. You never commit on it; `git fetch` moves it.
rerere
"Reuse recorded resolution": Git remembers how you resolved a conflict and applies the same fix if it appears again.
reset
Moves the current branch to another commit. `--soft` keeps changes staged, the default keeps them unstaged and `--hard` discards them.
rev-parse
Prints the hash that a name such as `HEAD@{1}` or `main` stands for, so you can check before acting.
ruleset
A set of rules GitHub enforces on branches, such as requiring a pull request, approvals and passing checks, and blocking force pushes on main.

S

semantic versioning
Numbering releases MAJOR.MINOR.PATCH: raise MAJOR for breaking changes, MINOR for added features and PATCH for fixes.
shallow clone and partial clone
A shallow clone (`--depth 1`) fetches only the newest commits; a partial clone (`--filter=blob:none`) fetches all commits but gets old file contents only when needed.
shebang
The first line of a script, like `#!/usr/bin/env bash`, naming the program that should run it. Hooks need one.
signed commits and tags
Commits and tags signed with a key, such as an SSH key, to prove who made them.
sparse checkout
A working tree with only some folders present, while the full history stays in `.git`. Priya uses it to work on just docs and shop.
squash merge
Merging a branch as one new commit; the branch's own commits don't come along. Kettle & Crane allows only this button on GitHub.
stacked pull requests
Pull requests where one builds on another. `git rebase --update-refs` moves every branch in the stack at once.
stash
A shelf where Git keeps unfinished changes while you switch tasks. Use `-u` for untracked files, `apply` to keep the entry and `pop` to remove it.
status checks
Automatic tests that must pass before GitHub lets a pull request merge, if the ruleset requires them.
submodule
A way to place one repository inside another, the opposite approach to a monorepo.
suggested change
A review comment holding a proposed fix that the author can apply with one click (Commit suggestion).

T

three-dot diff
`git diff A...B` shows only what B changed since it split off from A, which is what GitHub shows on the Files changed tab.
to-do list
The list of commits and commands that `git rebase -i` opens in your editor, oldest commit first. You change `pick` to reword, edit, squash, fixup or drop.
trunk-based development
A branching strategy where everyone merges small changes into main at least daily, with branches lasting hours.
two-dot range
`A..B` means the commits in B that aren't in A. `git log --oneline main..origin/feature/holiday-blend` shows what Jo has that Sam's main lacks.

U

upstream
By custom, the name of the remote pointing to the original repository that a fork came from.

W

WIP
"Work in progress", a commit message for unfinished work. The commit-msg hook refuses summaries starting with it.
working tree
The folder of files you edit. A bare repository has none, which is why `git status` doesn't work in it.
worktree
An extra working folder for the same repository with its own branch checked out. Sam uses one for an urgent fix without stashing his feature work.

Z

zdiff3
A conflict style, set with `merge.conflictStyle`, that also shows the merge base between `|||||||` and `=======`.