git-fetch
Download objects and refs from remote repositories
TLDR
SYNOPSIS
git fetch [options] [remote] [refspec...]
DESCRIPTION
git fetch retrieves commits, files, and references from a remote repository, updating your local repository's knowledge of remote branches without modifying your working directory or current branch. This makes it a safe operation for staying synchronized with remote changes.When you fetch, Git downloads all new commits and objects from the remote and updates remote-tracking branches (like origin/main). Your local branches remain unchanged, allowing you to review remote changes before integrating them. This is the crucial distinction from git pull, which fetches and then automatically merges.The prune option (-p) removes references to remote branches that no longer exist on the server. Shallow fetches with --depth limit history download, useful for CI/CD environments. The --unshallow option converts a shallow clone to a complete repository.
PARAMETERS
--all
Fetch all remotes.-p, --prune
Remove deleted remote refs.--tags
Fetch all tags.--depth depth
Shallow fetch.--dry-run
Show what would be fetched.-j, --jobs n
Parallel fetches for submodules.--unshallow
Convert shallow to full.-f, --force
Allow non-fast-forward updates of remote-tracking branches.--no-tags
Do not download any tags (overrides remote.<name>.tagOpt).-t, --tags
Fetch all tags from the remote, in addition to whatever else would be fetched.--update-shallow
Accept refs that update .git/shallow, deepening the shallow clone.--filter SPEC
Partial-clone filter, e.g. `blob:none` (omit blobs) or `tree:0` (commits only).--recurse-submodules [=on-demand|yes|no]
Control submodule fetching behavior.-q, --quiet / -v, --verbose
Suppress / increase progress output.