The snippet library.
Small, practical examples. Search by task or narrow things down below.
Stage a new file
Git: Stage a new file inside the disposable repository created by the input setup.
Git✓ Tested
Stage a tracked file rename
Git: Stage a tracked file rename inside the disposable repository created by the input setup.
Git✓ Tested
Stage one file
Add one changed file to the next commit.
add✓ Tested
Stash edits to one chosen file
Git: A pathspec limits the stash to selected paths while other changes remain in the working tree.
Git✓ Tested
Stash only the staged changes
Git: The staged option saves index changes while keeping unrelated unstaged edits.
Git✓ Tested
Stash unstaged work while leaving staged edits available
Git: Keep-index preserves the staged state for testing or committing while stashing the rest.
Git✓ Tested
Stop tracking a generated file while keeping it locally
Git: Removing a path from the index leaves its working copy intact when cached is specified.
Git✓ Tested
Summarize added and removed lines numerically
Git: Numstat provides tab-separated counts suitable for processing.
Git✓ Tested
Switch to a newly created branch
Git: Switch to a newly created branch inside the disposable repository created by the input setup.
Git✓ Tested
Temporarily store tracked-file edits
Restore a clean working tree and then reapply your saved changes.
stash✓ Tested
Test whether one revision is an ancestor of another
Git: merge-base --is-ancestor reports its answer through the exit status.
Git✓ Tested
Test whether tracked working files changed
Git: A quiet diff returns status one for differences, so handle it in a conditional.
Git✓ Tested