FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

125 snippets foundClear filters
GitMerging & replaying changes

Abort a conflicting cherry-pick

Git: Abort removes the incomplete replay and returns to the previous branch state.

Git✓ Tested
GitMerging & replaying changes

Abort a conflicting rebase

Git: Abort returns the branch to its state before the rebase attempt.

Git✓ Tested
GitMerging & replaying changes

Abort a merge with unresolved conflicts

Git: Abort restores the pre-merge state in this clean practice repository.

Git✓ Tested
GitRestoring & revising local work

Add a forgotten file to the latest unpublished commit

Git: Stage the missing file before amending without changing the message.

Git✓ Tested
GitStashing selected work

Apply a stash while keeping the saved entry

Git: Apply restores changes without removing the stash reference.

Git✓ Tested
GitStashing selected work

Apply and remove a successfully restored stash

Git: Pop removes the entry only after a successful application.

Git✓ Tested
GitMerging & replaying changes

Apply one commit from another branch

Git: Cherry-pick replays the selected change as a commit on the current branch.

Git✓ Tested
GitGetting Started

Check a change for whitespace problems

Git: Check a change for whitespace problems inside the disposable repository created by the input setup.

Git✓ Tested
GitRemotes & additional checkouts

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
GitCommit history & revision selection

Check what kind of Git object a revision names

Git: cat-file -t distinguishes a commit, tree, blob, or annotated tag.

Git✓ Tested
GitRemotes & additional checkouts

Clone a local bare repository

Git: A local remote provides the same clone workflow without any network dependency.

Git✓ Tested
GitMerging & replaying changes

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