Skip to content

feat: add copy branch URL keybinding to branches panel#5333

Open
tiwari91 wants to merge 1 commit intojesseduffield:masterfrom
tiwari91:feature/copy-branch-url
Open

feat: add copy branch URL keybinding to branches panel#5333
tiwari91 wants to merge 1 commit intojesseduffield:masterfrom
tiwari91:feature/copy-branch-url

Conversation

@tiwari91
Copy link

@tiwari91 tiwari91 commented Mar 2, 2026

Summary

  • Adds a new keybinding (<c-u>) in the branches panel to copy the selected branch's web URL to the clipboard
  • Supports all hosting services: GitHub (/tree/), GitLab (/-/tree/), Bitbucket (/src/), Azure DevOps (?version=GB), Bitbucket Server (/browse?at=), Gitea (/src/branch/), and Codeberg (/src/branch/)
  • Follows the exact same pattern as the existing "copy pull request URL" (<c-y>) feature

Closes #1959

Changes

  • definitions.go — added branchURL template to all 7 service definitions
  • hosting_service.go — added branchURL field, getBranchURL on Service, GetBranchURL on HostingServiceMgr
  • host_helper.go — added GetBranchURL helper
  • user_config.go — added CopyBranchURL config with default <c-u>
  • english.go — added translation strings (description, toast, action, keybinding label)
  • branches_controller.go — registered keybinding and copyBranchURL() handler
  • hosting_service_test.go — added TestGetBranchURL with 13 scenarios covering all services

Test plan

  • go test ./pkg/commands/hosting_service/... passes
  • go build ./... succeeds
  • Manual: run lazygit in a repo with a remote, go to branches panel, press <c-u> — branch URL should be copied and a toast shown

Add a new keybinding (<c-u>) in the branches panel to copy the branch's
web URL to the clipboard (e.g. https://github.com/user/repo/tree/branch).
Follows the same pattern as the existing "copy pull request URL" feature.

Supports GitHub, GitLab, Bitbucket, Azure DevOps, Bitbucket Server,
Gitea, and Codeberg.

Closes jesseduffield#1959
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.

Copy branch URL to clipboard

1 participant