Skip to content

Show current branch name in the repository list#76

Merged
pol-rivero merged 4 commits intopol-rivero:mainfrom
guplem:gdp-show-branch-in-repo-list
Mar 6, 2026
Merged

Show current branch name in the repository list#76
pol-rivero merged 4 commits intopol-rivero:mainfrom
guplem:gdp-show-branch-in-repo-list

Conversation

@guplem
Copy link

@guplem guplem commented Mar 5, 2026

Note: This is a direct port of desktop/desktop#21742 to GitHub Desktop Plus. The upstream PR addresses desktop/desktop#8158, a long-requested feature (since 2018) that has not yet been merged due to the help wanted label requirement. We're submitting it here as well since GDP is more likely to accept community contributions and ship it to users sooner.

Fixes desktop#8158

Summary

  • Displays the currently checked out branch name next to each repository name in the sidebar repository list
  • Helps users distinguish between multiple clones or worktrees of the same repository without having to open each one
  • Branch name is shown inline with a git branch icon in secondary/muted text styling
  • Branch name is also included in both hover tooltips and keyboard-focus tooltips
  • The feature is opt-in via Settings/Options > Appearance > "Show current branch name next to repository name" (disabled by default)

Motivation

This is a long-requested feature (see #8158, #5764, #7856, #15544, #16112, #17274, #17880) that addresses a common pain point: when users have multiple clones or worktrees of the same repository, the repository list shows identical names with no way to tell them apart without clicking through each one.

This is increasingly relevant with the rise of AI coding agents, where developers commonly maintain multiple clones of the same repo working on different branches simultaneously.

Implementation

The change is minimal and follows existing patterns in the codebase:

  1. Model (ILocalRepositoryState): Added optional branchName field
  2. Store (app-store.ts): Populated from status.currentBranch which is already fetched; added persisted preference show-branch-name-in-repo-list
  3. Data flow (group-repositories.ts, repositories-list.tsx): Passed through existing data pipeline, gated by the preference
  4. UI (repository-list-item.tsx): Rendered inline with a branch icon, in secondary text color
  5. Styles (_repository-list.scss): Styled to be subtle and truncate gracefully
  6. Preference (appearance.tsx): Checkbox under the "Repository list" section in the Appearance preferences tab

No new data fetching is required — the branch name is already available from the existing git status calls.

Enabling the feature

Users can enable this feature:

  • macOS: GitHub Desktop > Settings > Appearance > check "Show current branch name next to repository name"
  • Windows: File > Options > Appearance > check "Show current branch name next to repository name"

Add a preference toggle (disabled by default) in the Appearance tab
under "Repository list" to show the current branch name next to
each repository name in the sidebar. The branch name appears with
a git-branch icon in a secondary color with ellipsis for overflow.

Resolves desktop#8158

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@guplem guplem changed the title Add optional branch name display in repository list Show current branch name in the repository list Mar 5, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pol-rivero
Copy link
Owner

pol-rivero commented Mar 5, 2026

Thank you for your contribution :) I agree that this is a nice improvement and everything works as advertised.

If you don't mind, I'll update the design slightly. Currently, the repo and branch names are hard to distinguish at a glance because everything is crammed together to the left. I'll probably move it to the right to make it easier to read. Do you agree?

Current design

image

New design

image image

@guplem
Copy link
Author

guplem commented Mar 5, 2026

Hmmm, go ahead if you are convinced, but I am not going to lie; I am not onboard...

The reason I wanted to add the branch next to the name is because I wanted to quickly identify the repo I am looking for. So name - branch next to each other seemed the simplest/fastest way. Having to look to the left and to the right seems a bit "confusing" because "following the line" may be difficult for some people.
Besides, how would long names of branches look? At which point do you start trimming the repo name or the branch name?
And the placement of the "has changes" (blue circle) and "pending push" (arrow up) indicators in the middle simply seems odd to me.

I prefer my design because placing the branch name directly after the repository name allows for much faster identification. Keeping these two elements together creates a single logical unit, which avoids the need to follow a "long" horizontal line. In the second design, the gap between the name and the branch can be difficult to scan.

Additionally, the inline layout handles long names and status icons more effectively. It is much clearer how to manage text truncation when the elements are adjacent, whereas the second design creates uncertainty about which part should be shortened first to avoid overlapping. The placement of the "has changes" and "pending push" indicators in the middle also feels disconnected; in the first design, these icons remain attached to the right, making the repository's state much easier to understand at a glance (always at the right side).

Besides this... the rest is subjective, and the fork is yours, so your choice! 😅😂

@guplem
Copy link
Author

guplem commented Mar 5, 2026

What are your thoughts on placing the branch name inside a "pill" or tag with a subtle background color, positioned directly after the repository name?
This approach would maintain the benefits of proximity for faster identification while creating a clear visual distinction between the repository name and its branch. It also simplifies the handling of long names and ensures that status icons remain logically grouped.

I have created a quick mockup with Gemini to express this idea:

image

@pol-rivero
Copy link
Owner

I can see your point.
From all the designs we have considered until now, I think your pills proposal in the last comment is the best one.

@pol-rivero
Copy link
Owner

Also, this is not related to the branch name indicator, but it seems that you need to work with several branches of the same repo simultaneously. In that case, have you considered git worktrees? We recently added support for them.

@guplem
Copy link
Author

guplem commented Mar 6, 2026

Thanks for the suggestion! I have actually tried worktrees, but I didn't love them, and I saw more advantages by re-cloning the repos.

The main dealbreaker is the branch restriction: you cannot have the exact same branch checked out in multiple worktrees simultaneously. I often need the same branch open in two places to create cherry picks, visualize the work of AI agents with different tasks, ... and separate clones give me total freedom for that.

Besides, the cleanup is just an extra hassle. With a normal clone, I just delete the folder (rm -rf) and I am done. With worktrees, deleting the folder leaves the main repo confused with leftover metadata, so you have to remember to run git worktree remove or prune every time.

So yeah, isolated clones simply work better for my workflow 😅

@pol-rivero
Copy link
Owner

Sure thing. Everyone has their preferred way of working :)

guplem and others added 2 commits March 6, 2026 09:46
Add a rounded pill background to the branch name indicator using
a new --branch-pill-background-color CSS variable. The pill adapts
to light/dark themes and selected/focused list item states, matching
the existing badge styling conventions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The branch-name element was nested inside the .name div which has
overflow:hidden, causing the pill's rounded corners to be clipped
with a straight edge when text overflows. Moving it to a sibling
flex item preserves the pill's border-radius during truncation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@guplem
Copy link
Author

guplem commented Mar 6, 2026

This is how it would look with the new design:

image image

Thanks for the challenge; I'm really liking it!

@pol-rivero
Copy link
Owner

Looks good!
Thank you for your PR :)

@pol-rivero pol-rivero merged commit 8fd53d1 into pol-rivero:main Mar 6, 2026
14 checks passed
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.

Add branch name to UI repository selection menu

2 participants