Git Reference ยท Configuration Options
fetch.prune and fetch.parallel settings
Reference for fetch.prune, fetch.pruneTags, fetch.parallel, fetch.recurseSubmodules and fetch.writeCommitGraph: tidy remote-tracking refs and speed up fetches.
git fetch downloads new commits and updates remote-tracking branches such as origin/main. The fetch.* settings change what else it does. The most useful one, fetch.prune, deletes remote-tracking branches whose branch no longer exists on the server, so your git branch -r list stops accumulating dead entries.
git config --global fetch.prune true git config --global fetch.parallel 4 git config --global fetch.writeCommitGraph true
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
git config fetch.prune (true | false) git config fetch.pruneTags (true | false) git config fetch.parallel <n> git config fetch.recurseSubmodules (true | false | on-demand) git config fetch.writeCommitGraph (true | false) git config fetch.fsckObjects (true | false) git config fetch.unpackLimit <n>
| Name | Description |
|---|---|
fetch.prune |
Remove remote-tracking refs that no longer exist on the remote (same as git fetch --prune). |
fetch.pruneTags |
Also remove local tags that no longer exist on the remote. Works together with prune. |
fetch.parallel |
How many submodules or remotes to fetch at once. 0 picks a number based on CPUs; 1 (default) is sequential. |
fetch.recurseSubmodules |
Fetch submodules too. Default on-demand fetches only changed ones. |
fetch.writeCommitGraph |
Update the commit-graph file after fetching, which speeds up later git log and merge-base queries. |
fetch.fsckObjects |
Check received objects for corruption (falls back to transfer.fsckObjects; see transfer.fsckObjects). |
fetch.unpackLimit |
Objects below this count are stored loose; above it, the pack is kept. |
Edge cases: pruning only touches refs under the destination namespace of the fetch refspec (normally refs/remotes/<remote>/); local branches are never deleted.
Usage notes
fetch.pruneis safe. It deletes only remote-tracking refs, which Git recreates on the next fetch if the branch comes back. Your own work is not touched.pruneTagsis riskier. A local tag that you never pushed disappears if the remote has no such tag, because the effective refspec becomesrefs/tags/*:refs/tags/*.- Setting per remote:
remote.<name>.pruneandremote.<name>.pruneTagsoverride the global values. fetch.parallelhelps repositories with many submodules or when fetching a group of remotes (git fetch --all); a single remote with one repository is not made faster.- What fetch never does: it does not change your working tree or local branches. Use
git pullorgit mergefor that. - Maintenance:
fetch.writeCommitGraphis mostly useful in large repositories;git maintenancecan do the same job in the background.
Related
git fetch,git remote,pull.rebase,maintenance.*- Lessons: Remotes, Push and pull