Git commands: my cheat sheet
The Git commands I keep coming back to, grouped by what you're doing: daily work, branches, undoing, remotes, history, worktrees and more.
11 entries
The Git commands I keep coming back to, grouped by what you're doing: daily work, branches, undoing, remotes, history, worktrees and more.
Part 1 of the Git guide: what Git is, a one-time setup, a first repository, the three areas a change passes through and the four states of a file.
Part 4 of the Git guide: what a branch really is, fast-forward and merge commits, how a three-way merge decides, and how to resolve a conflict calmly.
Part 2 of the Git guide: how to read git diff, what each diff command compares, good commit messages, git log, and what a commit really contains.
Part 5 of the Git guide: rebase and the one rule that comes with it, interactive rebase to tidy commits, then stash, cherry-pick, bisect and .gitignore.
Part 6 of the Git guide: clone, push, fetch and pull, remote-tracking branches and ahead/behind, what to do when a push is rejected, force-with-lease and tags.
Part 3 of the Git guide: naming commits (HEAD~1, HEAD^2, HEAD@{2}), detached HEAD, and the right undo for each mistake: restore, amend, reset, revert and reflog.
Part 1 of the GitHub guide: what GitHub adds to Git, creating a repository, signing in with gh, an SSH key or a token, and putting a project online.
Part 4 of the GitHub guide: a first Actions workflow, secrets and permissions, publishing a site with GitHub Pages, releases with generated notes, Codespaces and Copilot.
Part 3 of the GitHub guide: issues and labels, contributing to someone else's project through a fork, branch protection, CODEOWNERS and keeping a repository safe.
Part 2 of the GitHub guide: the GitHub flow step by step, a good pull request, reviewing with comments and suggestions, and the three ways to merge.