gritHEAD → docs/fetch
Commands / RemotesMarkdown

grit fetch

Download new commits, branches and tags from a remote.

grit fetch [<remote>]

Description

Downloads everything new from a remote and updates your remote-tracking branches, such as origin/main, along with any new tags. Your own branches and working tree are left alone; to bring the new commits into your branch, use grit merge or grit pull.

<remote> may be a configured remote name or a path to a git bundle file (detected by the bundle signature, not the file extension). Bundle fetches verify that prerequisite commits are already in your repository before applying the pack.

Each updated ref is listed with its old and new commit.

Repositories created as shallow clones with Git (for example git clone --depth 1) are supported: grit fetch respects the existing shallow boundary, does not create tag refs to missing commits, and leaves a clean repository when there is nothing new to download.

Options

Option Description
<remote> Configured remote name, or a path/URL to a repository or bundle file. Defaults to origin.

JSON output

Pass --json for stable, scripting-friendly output:

Field Type Meaning
remote string Remote that was fetched.
updates array Ref updates, each with ref, old_oid, and new_oid.
updated number Count of refs that changed.

old_oid is null for a ref that is new, and new_oid is null for one that was removed.