Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove-GitTag: New command proposal #16

Open
johlju opened this issue Oct 15, 2024 · 0 comments
Open

Remove-GitTag: New command proposal #16

johlju opened this issue Oct 15, 2024 · 0 comments

Comments

@johlju
Copy link
Member

johlju commented Oct 15, 2024

Command proposal

Removes the tag in one or more remotes and optionally in the local repository

Proposed parameters

Parameter Mandatory Data type Description Default value Allowed values
Tag Yes String[] Specifies the tag to remove. None -
Remote No String[] Specifies the remote form where the tag should be removed. None -
Local No Switch  Specifies that the tag should be removed from the local repository None -
Parameter set Parameters Comment
Tag Tag Removes the tag from local repository (assumes -Local).
RemoteOrLocal Tag, Remote, Local  Supports removing a tag from either a remote or local, or both.

Special considerations or limitations

Should handle multiple tags and multiple remotes.

# List of tags to be removed
$tags = @(
  "3.1.3.4-PSGallery",
  "3.10.0.0-PSGallery",
  "3.11.0.0-PSGallery",
  "3.12.0.0-PSGallery",
  "3.13.0.0-PSGallery",
  "3.2.0.0-PSGallery",
  "3.3.0.0-PSGallery",
  "3.4.0.0-PSGallery",
  "3.5.0.0-PSGallery",
  "3.6.0.0-PSGallery",
  "3.7.0.0-PSGallery",
  "3.8.0.0-PSGallery",
  "3.9.0.0-PSGallery",
  "4.0.0.0-PSGallery",
  "5.0.0.0-PSGallery",
  "5.1.0.0-PSGallery",
  "5.2.0.0-PSGallery",
  "6.0.0.0-PSGallery",
  "6.1.0.0-PSGallery",
  "6.2.0.0-PSGallery",
  "6.3.0.0-PSGallery",
  "6.4.0.0-PSGallery",
  "7.0.0.0-PSGallery",
  "8.0.0.0-PSGallery",
  "8.1.0.0-PSGallery",
  "8.2.0.0-PSGallery",
  "8.3.0.0-PSGallery",
  "8.4.0.0-PSGallery",
  "8.5.0.0-PSGallery",
  "8.6.0.0-PSGallery",
  "8.7.0.0-PSGallery",
  "8.8.0.0-PSGallery",
  "v9.2.0"
)

# Remove tags
foreach ($tag in $tags) {
  # Delete tag locally
  git tag -d $tag
  
  # Delete tag from remote 'origin'
  git push origin :refs/tags/$tag
  
  # Delete tag from remote 'my'
  git push my :refs/tags/$tag
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant