Skip to content

Git: Add "Copy Branch Name" to branch context menus#301576

Closed
sinasab wants to merge 1 commit intomicrosoft:mainfrom
sinasab:add-copy-branch-name-to-context-menu
Closed

Git: Add "Copy Branch Name" to branch context menus#301576
sinasab wants to merge 1 commit intomicrosoft:mainfrom
sinasab:add-copy-branch-name-to-context-menu

Conversation

@sinasab
Copy link

@sinasab sinasab commented Mar 13, 2026

Summary

The git.repositories.copyBranchName command already exists and works in the Source Control Repositories view (scm/artifact/context), but is missing from two commonly used branch context menus:

  • git.branch submenu — the Branch menu in the SCM panel (right-click → Branch)
  • scm/historyItemRef/context — right-clicking on branch ref labels in the Source Control Graph

This PR adds the command to both menus, making it easy to copy a branch name from anywhere you interact with branches.

image image

Test plan

  • Open the SCM panel → right-click a branch in the Branch submenu → verify "Copy Branch Name" appears
  • Open the Source Control Graph → right-click a branch ref label → verify "Copy Branch Name" appears
  • Verify the copied text matches the branch name
  • Verify the option only appears for branch refs, not tag refs (in the graph view)

Fixes #148069

@vs-code-engineering
Copy link
Contributor

vs-code-engineering bot commented Mar 13, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/package.json
  • extensions/git/src/commands.ts

Add a new `git.graph.copyBranchName` command to:
- `git.branch` submenu (SCM panel Branch menu)
- `scm/historyItemRef/context` (right-click on branch refs in graph)
@sinasab sinasab force-pushed the add-copy-branch-name-to-context-menu branch from 4cdcce5 to d444473 Compare March 15, 2026 20:52
@sinasab
Copy link
Author

sinasab commented Mar 15, 2026

will reopen a cleaned up version, apologies!

@sinasab sinasab closed this Mar 15, 2026
@sinasab sinasab deleted the add-copy-branch-name-to-context-menu branch March 15, 2026 21:01
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

Successfully merging this pull request may close these issues.

Git - Add copy branch name in the sync status bar item hover

3 participants