Files
holocron/plugins/git/skills/git-remotes/references/fetch.md
Defame1297 38eb0745b7 refactor(git-remotes): retrofit to the ADR-0020 context contract
Description 582 -> 237 chars, body 1217 -> 290 words. The single remotes.md
splits into config, fetch, push, and pull flow files.

Restores the confirm: true token to the force-push gate -- it is the git
plugin's cross-skill contract, gated on by git-orchestrate and git-branches.
Moves push.md's worked example off main, which the skill's own Step 1
refuses, and restores the never-bare---force directive.
2026-08-30 13:10:53 +00:00

1.2 KiB

topic, source_keys
topic source_keys
fetch
git-scm-fetch-docs
context7-git-htmldocs

Fetching

Fetch updates remote-tracking branches (refs/remotes/<name>/*) and never modifies a local branch, so it is always safe to run.

  • One remote: git fetch <remote> — all branches
  • One branch: git fetch <remote> <branch> — the result lands in FETCH_HEAD, not a tracking ref
  • All remotes: git fetch --all
  • Prune properly: git fetch --all --prune --prune-tags cleans stale branches and tags
  • Auto-prune: git config --global fetch.prune true (or remote.<name>.prune to scope it to one remote), and fetch.pruneTags true for tags

Shallow and partial fetch

git fetch --depth=<n>             # deepen history, or create a shallow clone
git fetch --unshallow             # convert a shallow clone to full history
git fetch --update-shallow        # allow the fetch to update the shallow boundary
git fetch --refmap='' <remote> <branch>  # fetch without updating any tracking ref (FETCH_HEAD only)

Default fetch refspec

The default is +refs/heads/*:refs/remotes/<name>/*. The leading + forces the update — remote-tracking branches always mirror the remote exactly and offer no protection for local history.