By admin , 29 April 2026

Four object types

Git stores everything as content-addressable objects under .git/objects. There are four types: blob (file contents), tree (directory listing of blobs and subtrees), commit (snapshot pointer with author, committer, message, and parents), and tag (annotated tag with signer and message). Each is named by the SHA-1 (or SHA-256) of its content.

By admin , 29 April 2026

The problem worktrees solve

You are mid-feature when an urgent hotfix request arrives. Stashing or context-switching is risky and slow. Worktrees let you check out additional branches into separate directories, all sharing one underlying object database. Each worktree has its own HEAD, index, and working tree.

By admin , 29 April 2026

The case for SSH signing

GPG is powerful but operationally painful. Since Git 2.34, you can sign commits and tags with the SSH keys you already use to push. No keyring, no passphrase juggling, no separate web of trust. GitHub, GitLab, Gitea, and Forgejo all accept SSH-signed commits.

By admin , 29 April 2026

Why sign

A signed commit cryptographically attests "this commit was authored by the holder of this key, unchanged since signing." Signatures defend against impersonation and tampering, and platforms like GitHub display a "Verified" badge when the signature matches a configured key.

By admin , 29 April 2026

What gitattributes does

.gitattributes applies per-path settings: line endings, diff and merge drivers, export filters, encoding declarations, and merge behavior. Unlike .gitignore, attributes apply to tracked files and are honored by the entire team because the file is committed.

Line endings

The most common use. Tell Git to normalize text files in the repo to LF, while letting native checkouts on Windows convert to CRLF:

By admin , 29 April 2026

Why custom diffs

Git's default diff is line-by-line text. For binary formats (PDF, DOCX, images) and structured text where line diffs are unhelpful (minified JS, generated SQL dumps), custom diff drivers produce something humans can read.

Built-in language drivers

Git ships with hunk-header patterns for many languages: ada, bash, bibtex, cpp, csharp, css, dts, elixir, fortran, fountain, golang, html, java, kotlin, markdown, matlab, objc, pascal, perl, php, python, ruby, rust, scheme, tex. Activate via gitattributes:

By admin , 29 April 2026

Strategies vs drivers

A merge strategy decides how Git combines two histories — ort (default since Git 2.34), recursive (legacy), resolve, octopus, and ours. A merge driver is per-file logic that runs when both sides have changed the same file. Choose the right tool for the right level.

By admin , 29 April 2026

After the fact

Where commit-time hooks shape commits, the hooks on this page react to them. post-commit runs locally after each commit, pre-push runs before transferring objects to a remote, and post-receive runs on the server after a push lands.

post-commit

Cannot block — runs after the commit is recorded. Useful for notifications, ctags regeneration, or kicking off background tasks.

By admin , 29 April 2026

Client-side hooks

Hooks are executable scripts in .git/hooks/ (or wherever core.hooksPath points). Git invokes them at well-defined moments. The three commit-time hooks let you enforce policy before a commit is finalized.

pre-commit

Runs before the commit message is composed. Exit non-zero to abort. Typical uses: linting, formatting, secret scanning, running fast tests.

By admin , 29 April 2026

What rerere does

Rerere — "reuse recorded resolution" — watches you resolve a merge conflict, records the resolution, and replays it the next time the same conflict appears. It is invaluable on long-lived branches that repeatedly rebase or merge against an active main, and on release branches that frequently re-merge feature branches.

Enabling

git config --global rerere.enabled true
git config --global rerere.autoupdate true

autoupdate stages the resolved hunks for you when rerere has a confident answer.