The non-destructive half of git pull.
Download new commits, trees, blobs, and refs from a remote — but don't change your working tree or current branch. The non-destructive half of git pull.
Fetch updates refs/remotes/<remote>/*. Your local branches and working tree are untouched. After fetch, git log @{u}..HEAD (commits you have that upstream doesn't) and git log HEAD..@{u} (commits upstream has that you don't) become meaningful queries.
git fetch [<options>] [<repository> [<refspec>...]]
git fetch [<options>] <group>
git fetch --multiple [<options>] [(<repository> | <group>)...]
git fetch --all [<options>]| Flag | What it does |
|---|---|
--all | Fetch from all remotes. |
--prune, -p | Delete local remote-tracking branches whose remotes are gone. |
--tags | Fetch tags. |
--depth=<n> | Shallow fetch. |
--unshallow | Convert a shallow clone to a full one. |
--dry-run | Show what would happen. |
$ git fetch$ git fetch --prune$ git fetch origin feature/login:refs/remotes/origin/feature/loginfetch.prune = true globally — keeps your remote-tracking refs honest.git fetch && git log @{u} over git pull. Fetch first, decide what to do.git fetch --all periodically if you have multiple remotes.--prune, deleted upstream branches linger forever in refs/remotes/origin/*.Hit each option, then Check answers. Score is recorded; Next is always open.