Pages

Topics

Tools

↑↓navigate↵openescclose

Git guides

Every published Git guide, newest first, with practical examples you can copy into your own project.

3,815 guides across 14 topics

Topics

Latest Git guides

3D illustration of a graveyard of faded commit blocks with a glowing reflog trail back
Git

Git reflog: Recovering Lost Commits and Deleted Branches

Every ref movement is logged locally for ninety days. How to undo a reset, restore an amended commit, and what fsck can still find when the log is gone.

GitRecoveryReflogCLI
3D illustration of a commit timeline with a magnifier over a blame column
Git

Git log, diff, show, and blame: Searching History by Content

Two dots are asymmetric, three dots compare against the merge base, -S counts occurrences while -G matches diffs. The filters that turn a slow search into a fast one.

GitHistoryDebuggingCLI
3D illustration of a commit block lifted by a claw from one branch track onto another
Git

Git Cherry-Pick: Commits, Ranges, and Conflict Handling

A..B excludes A, -x records where the change came from, and one change with two hashes breaks later reverts. Backports need a policy, not a habit.

GitCherry-pickReleaseCLI
3D illustration of a drawer holding modified file cards beside a stack of numbered stashes
Git

Git Stash: push, pop, apply, and Partial Stashing

A stash is a commit with two or three parents, and it leaves untracked files behind by default. When a temporary branch or a worktree is the better tool.

GitStashWorkflowCLI
3D illustration of three snapshot meters for soft, mixed and hard reset with a revert arrow
Git

Git reset vs revert vs restore: Soft, Mixed, Hard, and Undoing Safely

Three commands with three depths: reset rewrites the branch, revert adds a commit, restore touches files. Which one is still safe after a push.

GitUndoRecoveryCLI
3D illustration of commit blocks lifted onto a new base line and fused into one cube
Git

Git Interactive Rebase: Squash, Fixup, and --onto Workflows

Rebase replays commits onto a new base; --onto moves only a subset. Autosquash folds fixups without editing the todo list, and force-with-lease makes the result shareable.

GitRebaseHistoryCLI
3D illustration of two branch tracks joining with one conflict chip resolved
Git

Git Merge: Fast-Forward, Three-Way, and Conflict Resolution

Fast-forward moves a pointer; a three-way merge compares both tips to a merge base. Where ours and theirs invert, and why a squashed merge blocks re-merging.

GitMergeConflictsCLI
3D illustration of branch lines with a HEAD pointer floating free and a rescue arrow
Git

Git switch, checkout, and Detached HEAD Recovery

switch moves HEAD, restore touches files, checkout does both badly. How to leave a detached HEAD with your commits intact, and how to get back.

GitBranchingCLIRecovery
3D illustration of file cards moving through working, staging and commit trays
Git

Git Staging Area: status, add -p, commit --amend, and Partial Commits

The index is what a commit actually contains, which makes partial commits possible and commit -a dangerous. What amend rewrites, and when that is safe.

GitCommitStagingCLI
3D illustration of a local repository cube connected by a cable to a cloud remote cube
Git

Git Remote and Upstream Tracking: init, clone, and Branch Relationships

An upstream is a config line, not a copy of a branch. Why pull refuses to run, what a shallow clone breaks, and how origin and upstream differ in a fork.

GitRemoteBranchingCLI