Repository navigation
Git Menu Links
Some Git menu items only open a web page: Open Repository in Browser for any host, and the GitHub submenu's Open on GitHub, Create Pull Request, View Pull Requests and Copy GitHub Link. None of them calls an API or needs a sign-in. They read the remote URLs that repoStore.remotes already holds and build the address. The menu itself is in How the Git Menu Works; the user side is in Git Menu.
People often want to jump from the code to the project's page: to read issues, open a pull request or share a link. Remote URLs are often SSH addresses such as git@gitlab.com:team/app.git, which a browser cannot open, so the app turns them into web addresses. Not every project lives on GitHub, so the plain "open the repository" item works for any host.
Open Repository in Browser works for every host. views/git/remoteLinks.ts is pure: remoteWebUrl turns a remote URL into its web page (https stays, credentials and .git go; ssh, git:// and scp-like addresses become https without their port; Azure DevOps v3/ORG/PROJECT/REPO becomes dev.azure.com/ORG/PROJECT/_git/REPO; local paths and file:// give null). remoteLinks keeps one link per distinct page, from each remote's fetch and push URL, ordered upstream remote, then origin, then the rest.
flowchart LR
R["repoStore.remotes"] --> L["remoteLinks"]
L -->|"none"| T["toast: no remote with a web page"]
L -->|"one"| O["updates.open(url)"]
L -->|"several"| P["dialogs.pick: name and URL"] --> O
gitMenuInputs counts the links (remoteLinks), and the item is enabled when there is at least one. It is not blocked while git is busy, since it only opens a page.
views/git/github.ts is pure: it reads https, ssh, git:// and scp-like remote URLs, picks the upstream's remote, then origin, and builds file, compare and pull request URLs. No API and no sign-in are used. linkRevision uses the branch name only when the branch is pushed as it is, else the commit.
| File | What it does |
|---|---|
src/lib/views/git/remoteLinks.ts |
remoteWebUrl, remoteLinks, remoteLinkPickItems
|
src/lib/views/git/github.ts |
GitHub remotes, file, compare and pull request URLs, linkRevision
|
src/lib/views/git/gitMenuActions.ts |
openRemoteInBrowser, openOnGitHub, copyGitHubLink, createPullRequest
|
src/lib/views/git/gitMenuInputs.ts |
Counts the links and spots a github.com remote for the menu state |
src/lib/menu/menuState.ts |
Enables the items |
Any host, by convention. Open Repository in Browser guesses the page from the URL instead of asking each host's API. GitHub, GitLab, Bitbucket, Gitea and most servers serve the repository at the same path as the clone URL, so one rule covers them, with Azure DevOps SSH as the one special case.
Drop credentials and SSH ports. A token in an https remote must never reach the browser's history, and an SSH port (such as 2222) is not where the web server listens. An https port is kept, since a self-hosted server may serve both on it.
One link per page. A remote whose fetch and push URLs point at the same page appears once, and two remotes for the same page are not listed twice, so the list only asks when there is a real choice.
Ask only when needed. With one link the page opens at once; with several, the quick pick lists the remote your branch tracks first, so Enter opens the likely one.
-
src/lib/views/git/remoteLinks.test.ts: https, ssh,git://and scp-like URLs, credentials and ports, Azure DevOps, local paths and Windows drives, the remote order and duplicate pages. -
src/lib/views/git/github.test.ts: GitHub URL parsing, the remote choice and every link. -
src/lib/menu/menuState.test.ts, "Git menu": the items are enabled only with a link.
- Update this page when
remoteLinks.ts,github.tsor their menu items change, and Git Menu for visible changes. - Related: How the Git Menu Works, How GitHub Works, How Remotes Work.
These pages are generated from docs/wiki. To correct something, open a pull request against the source file; edits made here are overwritten.
Using Nibtree
- Getting Started
- Welcome Screen
- Workspaces
- Files Panel
- File Operations
- File Icons
- Rounded Panels
- Editor and Tabs
- Pin Reorder and Wrap Tabs
- Single Tab Title
- Split Editor
- New File and Unsaved Changes
- Unload Hidden Tabs
- Editing Code
- Code Appearance
- Markdown Editor
- Image and PDF Preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and Replace
- Changes and Commits
- Sign In Prompts
- Commit Box Layout
- Repository Actions
- Commit Options
- Ignoring Files
- Diffs
- Inline Diffs
- Staging View
- Revert a Change
- Resolving Conflicts
- Merge Tool
- Blame
- History and Log
- Merge Commits
- Branches and Tags
- Branches Popup
- Remotes
- Stashes
- Shelf
- Git Menu
- Git Dialogs
- Interactive Rebase
- Worktrees
- AI Agents
- AI Tasks
- AI Usage
- Keep Computer Awake
- Submodules
- Git LFS
- GitHub
- Git Console
- Terminal
- Terminal Features
- Scripts
- Navigation
- Menus
- Settings
- Settings Search
- Color Themes
- Settings Terminal and Automation
- Settings Files
- Updates
- Status Bar and Help
- Notifications
- Memory Use
- Clear Cache
- MCP and CLI
- Git Mergetool
- Keyboard Shortcuts
- Keyboard Shortcuts Editor
- Troubleshooting
- Troubleshooting Git
Developers
- Developer Guide
- Architecture
- Project Layout
- Backend
- How Folder Watching Works
- Folder Watching Bugs We Fixed
- How Workspace Files Work
- How the Preview Scheme Works
- Backend Services
- How Terminal Features Work
- Terminal Bugs We Fixed
- Frontend
- How the Rich Markdown Editor Works
- Rich Markdown Bugs We Fixed
- Git Menu Links
- Menu Keys and Routing
- Frontend Modules
- Blame Bugs We Fixed
- Project Color And Title Bar
- One Diff View
- Diff Bugs We Fixed
- Merge Tool Layouts
- Merge Tool Bugs We Fixed
- Color Theme Bugs We Fixed
- How the Connected Diff Works
- Rounded Panels Bugs We Fixed
- Update Bugs We Fixed
- Status Bar Bugs We Fixed
- MCP and CLI Bugs We Fixed
- Repository Actions Bugs We Fixed
- How the Changes Tab Works
- CodeMirror Patterns
- How the Cursor Works
- How Editor Features Work
- How the Path Bar Works
- Commands and Events
- Settings Reference
- Commands Workspace and Changes
- Commands Branches and Remotes
- Commands History and Extras
- Commands App and Tools
- Testing
- Test Suites
- Debugging
- Debugging with MCP
- Measuring Setting Memory
- How Terminal Memory Is Measured
- How Markdown Diagrams Work
- Releases and CI
- Publishing the Wiki
- Versioning and Changelog
- Browser Version Packages
- Browser Release Checks
- Docker Image
- Platforms and Signing
- Windows Support
- Windows Bugs We Fixed
- Windows MCP and CLI
- Docs and Screenshots
- UI Library
- UI Library MCP
- UI Library Bugs
- UI Library Migration
- Contributing
How features work
- Welcome screen
- Workspaces and folders
- Files panel
- File operations
- File icons
- Editor and tabs
- Pin, reorder and wrap tabs
- Single tab title
- Split editor
- New File and unsaved changes
- Unload hidden tabs
- Editing code
- Code appearance
- Markdown editor
- Image and PDF preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and replace
- Changes and commits
- Sign-in prompts
- Commit box layout
- Repository actions
- Commit options
- Ignoring files
- Diffs
- Inline diffs
- Staging view
- Revert a change
- Resolving conflicts
- Merge tool
- Blame
- History and log
- Merge commits
- Commit tabs
- Branches and tags
- Branches popup
- Remotes
- Stashes
- Shelf
- Git menu
- Git dialogs
- Interactive rebase
- Worktrees
- AI agents
- AI usage
- Keep computer awake
- AI tasks
- Submodules
- Git LFS
- GitHub account
- Git Console
- Back and Forward
- Integrated terminal
- Scripts tool window
- Menu bar
- Settings
- Search in Settings
- Color themes
- Rounded panels
- Updates and release channels
- Status bar and help links
- Notifications
- Memory readout and memory log
- Clear Cache
- MCP server and command line tool
- git mergetool mode