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

Preserve a feature branch boundary with a merge commit

Git: No-ff records a merge commit even when a fast-forward would be possible.

Git✓ Tested
GitRestoring & revising local work

Preview removal of an untracked scratch file

Git: The dry-run flag shows what clean would remove without deleting it.

Git✓ Tested
GitRemotes & collaboration

Pull without creating a merge commit

Update a branch only when its upstream can be fast-forwarded.

pull✓ Tested
GitRemotes & collaboration

Push a new branch and set its upstream

Connect a feature branch with its remote counterpart.

push✓ Tested
GitRemotes & additional checkouts

Push one selected release tag

Git: Naming a single tag avoids pushing every local tag unintentionally.

Git✓ Tested
GitCommit history & revision selection

Read a complete commit message

Git: The B placeholder includes the subject and body without extra metadata.

Git✓ Tested
GitCommits & history

Read a file from a commit

Inspect committed content without changing your working copy.

show✓ Tested
GitGetting Started

Read a file from the latest commit

Git: Read a file from the latest commit inside the disposable repository created by the input setup.

Git✓ Tested
GitCommit history & revision selection

Read a file from the parent commit

Git: HEAD~1 names the first parent one generation before HEAD.

Git✓ Tested
GitTags & repository configuration

Read a repository-specific configuration value

Git: The local scope makes configuration lookup predictable for this practice repository.

Git✓ Tested
GitTags & repository configuration

Read an annotated tag’s message

Git: for-each-ref can inspect annotation contents without including a commit diff.

Git✓ Tested
GitCommit history & revision selection

Read commit subjects affecting one file

Git: Place the path after -- so Git limits history to the selected file.

Git✓ Tested