Skip to content

[Feature] Add support for the git-fetch --prune-tags flag #1692

@goran-w

Description

@goran-w

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>)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions