📎 Webclip
git-tips
This page collects many short Git command recipes for common tasks. It covers everyday operations such as viewing diffs, switching branches, stashing changes, managing remotes, pruning branches, and working with tags, submodules, and worktrees.
It also includes commands for undoing work, restoring files, rebasing, cherry-picking, inspecting history, searching logs, and handling merges or conflicts. Several entries offer alternative command forms for the same task.
Reading notes#
- The page is a collection of
git-tipsand invites contributions through the linked contributing guide. - It mentions a CLI tool,
git-tip, for using these tips from the terminal. - It says the commands were tested with
git version 2.7.4 (Apple Git-66). - The tips cover everyday Git use in about twenty commands or so.
- It includes commands for help guides, overwriting pull results, and listing files, branches, and commits.
- It shows how to inspect staged and unstaged changes, conflicted files, branch history, and upstream tracking.
- It includes commands for deleting local and remote branches and tags.
- It shows ways to undo local changes, revert commits, reset commits, amend commit messages, and change authors.
- It includes remote URL changes, alias setup, and listing local and remote branches.
- It covers staging parts of files, shell completion, commit history since a date, and cherry-picking across branches.
- It shows how to work with stashes, tracked files, untracked files, ignored files, and worktrees.
- It includes cleaning untracked files, updating submodules, and renaming branches.
- It covers archive, bundle, subtree, and bundle import and export commands.
- It shows how to ignore a file on commit, use autostash during rebase, fetch pull requests by ID, and get the current branch name.
- It includes diff, log, and checkout commands for restoring deleted files and specific revisions.
- It covers Git configuration options for rebase behavior, case sensitivity, editors, autocorrect, rerere, file mode, and colored output.
- It includes commands for bisecting, bypassing hooks, cloning shallow or single-branch repositories, and force pushing with lease.
- It shows blame, shortlog, grep, first-parent history, merge commit counting, and a git undo alias.
