The snippet library.
Small, practical examples. Search by task or narrow things down below.
Abort a conflicting cherry-pick
Git: Abort removes the incomplete replay and returns to the previous branch state.
Git✓ Tested
Abort a conflicting rebase
Git: Abort returns the branch to its state before the rebase attempt.
Git✓ Tested
Abort a merge with unresolved conflicts
Git: Abort restores the pre-merge state in this clean practice repository.
Git✓ Tested
Add a forgotten file to the latest unpublished commit
Git: Stage the missing file before amending without changing the message.
Git✓ Tested
Apply a stash while keeping the saved entry
Git: Apply restores changes without removing the stash reference.
Git✓ Tested
Apply and remove a successfully restored stash
Git: Pop removes the entry only after a successful application.
Git✓ Tested
Apply one commit from another branch
Git: Cherry-pick replays the selected change as a commit on the current branch.
Git✓ Tested
Check a change for whitespace problems
Git: Check a change for whitespace problems inside the disposable repository created by the input setup.
Git✓ Tested
Check out another branch in a second working tree
Git: A linked worktree shares repository objects while maintaining a separate checked-out branch.
Git✓ Tested
Check what kind of Git object a revision names
Git: cat-file -t distinguishes a commit, tree, blob, or annotated tag.
Git✓ Tested
Clone a local bare repository
Git: A local remote provides the same clone workflow without any network dependency.
Git✓ Tested
Combine a branch’s changes into one new commit
Git: Squash prepares the combined changes in the index without recording a merge parent.
Git✓ Tested