Skip to content

Commit d0e0747

Browse files
avargitster
authored andcommitted
git remote doc: correct dangerous lies about what prune does
The "git remote prune <name>" command uses the same machinery as "git fetch <name> --prune", and shares all the same caveats, but its documentation has suggested that it'll just "delete stale remote-tracking branches under <name>". This isn't true, and hasn't been true since at least v1.8.5.6 (the oldest version I could be bothered to test). E.g. if "refs/tags/*:refs/tags/*" is explicitly set in the refspec of the remote, it'll delete all local tags <name> doesn't know about. Instead, briefly give the reader just enough of a hint that this option might constitute a shotgun aimed at their foot, and point them to the new PRUNING section in the git-fetch documentation which explains all the nuances of what this facility does. See "[BUG] git remote prune removes local tags, depending on fetch config" (CACi5S_39wNrbfjLfn0xhCY+uewtFN2YmnAcRc86z6pjUTjWPHQ@mail.gmail.com) by Michael Giuffrida for the initial report. Reported-by: Michael Giuffrida <[email protected]> Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2c72ed7 commit d0e0747

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Documentation/git-remote.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,14 @@ With `-n` option, the remote heads are not queried first with
172172

173173
'prune'::
174174

175-
Deletes all stale remote-tracking branches under <name>.
176-
These stale branches have already been removed from the remote repository
177-
referenced by <name>, but are still locally available in
178-
"remotes/<name>".
175+
Deletes stale references associated with <name>. By default, stale
176+
remote-tracking branches under <name> are deleted, but depending on
177+
global configuration and the configuration of the remote we might even
178+
prune local tags that haven't been pushed there. Equivalent to `git
179+
fetch --prune <name>`, except that no new references will be fetched.
180+
+
181+
See the PRUNING section of linkgit:git-fetch[1] for what it'll prune
182+
depending on various configuration.
179183
+
180184
With `--dry-run` option, report what branches will be pruned, but do not
181185
actually prune them.
@@ -189,7 +193,7 @@ remotes.default is not defined, all remotes which do not have the
189193
configuration parameter remote.<name>.skipDefaultUpdate set to true will
190194
be updated. (See linkgit:git-config[1]).
191195
+
192-
With `--prune` option, prune all the remotes that are updated.
196+
With `--prune` option, run pruning against all the remotes that are updated.
193197

194198

195199
DISCUSSION

0 commit comments

Comments
 (0)