Skip to content

feat: Add ability to delete tags locally and from remote - #22482

Closed
OmegaHawkeye wants to merge 1 commit into
desktop:developmentfrom
OmegaHawkeye:feature/remote-tag-delete
Closed

OmegaHawkeye wants to merge 1 commit into
desktop:developmentfrom
OmegaHawkeye:feature/remote-tag-delete

Conversation

@OmegaHawkeye

@OmegaHawkeye OmegaHawkeye commented Jul 4, 2026 •

Copy link
Copy Markdown

Summary

  • Extends the existing Delete tag menu item in the commit history to also remove the tag from the remote (with a confirmation dialog).
  • Adds pushDeleteTag to git/push.ts and extends deleteTag in git/tag.ts for the remote delete operation.
  • Tags queued for remote deletion are persisted in localStorage via tags-to-push-storage.ts so a network failure doesn't silently lose the intent.
  • Clears pending remote deletes when a repository is removed (RepositoriesStore).
  • The delete-tag confirmation dialog now exposes a "Also delete on remote" checkbox.
  • Updates CommitList so Delete tag is enabled for all local tags, not only unpushed ones.

Test plan

  • Create a tag on a commit with a connected remote.
  • Right-click the commit → Delete tag — confirm the dialog appears with the "Also delete on remote" checkbox.
  • With checkbox checked, verify the tag is removed from both local and remote.
  • With checkbox unchecked, verify only the local tag is removed.
  • Remove the repository; confirm no stale storage entries remain.

Closes the following issue #22481 (created by me)

@OmegaHawkeye
OmegaHawkeye requested a review from a team as a code owner July 4, 2026 19:40
@OmegaHawkeye
OmegaHawkeye requested review from Copilot and sergiou87 July 4, 2026 19:40
@github-actions github-actions Bot added external Pull request originating outside of the Desktop core team needs-triage unmet-requirements and removed needs-triage labels Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for your pull request! This is a large change (298 lines across 17 files) that doesn't reference a help wanted issue.

Large feature PRs require prior discussion in an issue before implementation — this helps the team assess whether the feature aligns with the project's direction before significant effort is invested.

Please open an issue to discuss this feature first. This PR will be automatically closed in 3 days if requirements are not met.

Full contribution requirements
  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends GitHub Desktop’s tag deletion workflow so users can delete tags locally and optionally delete them from the remote by queuing a delete refspec to be sent on the next push, with persistence via localStorage.

Changes:

  • Adds support for remote tag deletions by carrying :refs/tags/<tag> delete refspecs through the existing push flow and persisting pending deletions per repository.
  • Updates the delete-tag confirmation dialog to optionally request remote deletion (when applicable) and wires the option through Dispatcher → AppStore → GitStore.
  • Updates UI/state plumbing to surface pending remote tag deletions (push CTA messaging, repository state, popup model) and enables “Delete tag” for all local tags.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
app/test/unit/git/tag-test.ts Adds a unit test ensuring remote tag deletion works when pushed as a delete refspec.
app/test/unit/git-store-test.ts Adds a unit test verifying GitStore queues remote deletions and they’re applied on a later push.
app/src/ui/history/compare.tsx Passes a canDeleteRemote flag when opening the delete-tag dialog.
app/src/ui/history/commit-list.tsx Enables “Delete tag” for all local tags (not only unpushed).
app/src/ui/dispatcher/dispatcher.ts Extends deleteTag API and delete-tag popup to carry remote-delete capability.
app/src/ui/delete-tag/delete-tag-dialog.tsx Adds “Remove tag from remote” checkbox and forwards option to dispatcher.
app/src/ui/changes/no-changes.tsx Updates push CTA copy/conditions to include pending remote tag deletions.
app/src/ui/app.tsx Wires popup prop to dialog and counts remote deletions in the push indicator count.
app/src/models/popup.ts Extends DeleteTag popup detail to include canDeleteRemote.
app/src/lib/stores/repository-state-cache.ts Initializes repository state with tagsToDeleteOnRemote.
app/src/lib/stores/repositories-store.ts Clears persisted pending remote deletions when removing a repository.
app/src/lib/stores/helpers/tags-to-push-storage.ts Adds localStorage helpers for pending remote tag deletions.
app/src/lib/stores/git-store.ts Tracks pending remote tag deletions, persists them, and clears them on successful push.
app/src/lib/stores/app-store.ts Plumbs state through AppStore and passes tag deletion refspecs into push operations.
app/src/lib/git/tag.ts Adds a deleteRemoteTag helper and fixes deleteTag doc text.
app/src/lib/git/push.ts Adds tagsToDeleteOnRemote option and appends delete refspecs to git push.
app/src/lib/app-state.ts Extends repository state interface with tagsToDeleteOnRemote.

Comment on lines 56 to 58
<DialogFooter>
<OkCancelButtonGroup destructive={true} okButtonText="Delete" />
<OkCancelButtonGroup okButtonText="Delete" />
</DialogFooter>
Comment on lines 643 to +649
private onDeleteTag = (tagName: string) => {
this.props.dispatcher.showDeleteTagDialog(this.props.repository, tagName)
this.props.dispatcher.showDeleteTagDialog(
this.props.repository,
tagName,
this.props.repository.gitHubRepository !== null ||
this.props.currentBranch?.upstreamRemoteName != null
)
Comment on lines 374 to +379
await this.refreshTags()
this.removeTagToPush(name)

if (removeFromRemote) {
this.addTagToDeleteOnRemote(name)
}
Comment thread app/src/lib/git/push.ts
Comment on lines +69 to +76

if (options?.tagsToDeleteOnRemote !== null) {
args.push(
...(options?.tagsToDeleteOnRemote ?? []).map(
tagName => `:refs/tags/${tagName}`
)
)
}
Comment on lines +39 to +56
export function storeTagsToDeleteOnRemote(
repository: Repository,
tagsToDeleteOnRemote: ReadonlyArray<string>
) {
if (tagsToDeleteOnRemote.length === 0) {
clearTagsToDeleteOnRemote(repository)
} else {
setStringArray(getTagsToDeleteOnRemoteKey(repository), tagsToDeleteOnRemote)
}
}

export function getTagsToDeleteOnRemote(repository: Repository) {
return getStringArray(getTagsToDeleteOnRemoteKey(repository))
}

export function clearTagsToDeleteOnRemote(repository: Repository) {
localStorage.removeItem(getTagsToDeleteOnRemoteKey(repository))
}
@github-actions github-actions Bot closed this Jul 7, 2026
@OmegaHawkeye

Copy link
Copy Markdown
Author

Reopening after code review fixes were applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Pull request originating outside of the Desktop core team unmet-requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants