-
Notifications
You must be signed in to change notification settings - Fork 286
Description
Since Git 2.17 (Q2 2018), the git-fetch command has a flag --prune-tags
which can be used to:
- Remove any local tags that no longer exist on the remote
- Force-update any local tags that differ from the remote
NOTE: This flag must be used in combination with the --prune
flag (or its corresponding git-config fetch.pruneTags
) to actually do any pruning. The config variable is also considered by the git remote prune
command (which does not have the --prune-tags
flag).
This option should be used carefully, since (unlike --prune
) it will remove any local tag that's missing on the remote. (Also, when refs are mapped from multiple remotes into a single local namespace, extra care should be taken when pruning Tags!) Given these considerations, I may not want the option enabled constantly via git-config, but I want to be able to specify it as a flag when manually triggering a Fetch/Prune command.
In SourceGit
, this could be implemented by adding a "Prune Tags (--prune --prune-tags)
" checkbox in the Fetch Remote Changes
dialog.
(Alternatively, a confirmation dialog could be added to the "Prune" context-command for a selected Remote, with a "Prune Tags
" checkbox which would modify the command flags used: git -c fetch.pruneTags=true remote prune <remote>
)