Skip to content

Conversation

@EricGrill
Copy link

Summary

Adds a new keybinding (<c-u> / Ctrl+U) in the branches panel to copy the branch's URL to the clipboard. This complements the existing "copy pull request URL" feature.

Use Case

When you want to share a link to a specific branch (not a PR), you can now quickly copy the URL. For example:

  • https://github.com/owner/repo/tree/my-feature-branch

Changes

  1. Added branchURL field to ServiceDefinition for all supported hosting services
  2. Added GetBranchURL method to hosting service manager and helper
  3. Added CopyBranchURL keybinding and handler to branches controller
  4. Added translations for the new feature

Supported Services

Service URL Pattern
GitHub /tree/{branch}
GitLab /-/tree/{branch}
Bitbucket /branch/{branch}
Bitbucket Server /browse?at=refs/heads/{branch}
Azure DevOps ?version=GB{branch}
Gitea /src/branch/{branch}
Codeberg /src/branch/{branch}

Closes #1959

Test plan

  1. Open lazygit in a GitHub/GitLab/etc. repo
  2. Navigate to branches panel
  3. Select a branch
  4. Press <c-u>
  5. Verify the correct URL is copied to clipboard

🤖 Generated with Claude Code

Adds a new keybinding (ctrl+u) in the branches panel to copy the branch's URL
to the clipboard. This is similar to the existing "copy pull request URL"
feature but instead copies a URL that directly opens the branch in the browser.

Supported services:
- GitHub: /tree/{branch}
- GitLab: /-/tree/{branch}
- Bitbucket: /branch/{branch}
- Bitbucket Server: /browse?at=refs/heads/{branch}
- Azure DevOps: ?version=GB{branch}
- Gitea: /src/branch/{branch}
- Codeberg: /src/branch/{branch}

Closes jesseduffield#1959

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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