Conversation
There was a problem hiding this comment.
Pull request overview
Adds a user-configurable branch sorting preference that affects branch-selection views (e.g., branch dropdown/history compare), persisted in app state and exposed in Preferences.
Changes:
- Introduces a
BranchSortOrderpreference stored inAppStore/localStorage and wired through UI props. - Updates branch grouping/sorting logic to support Alphabet, Recently Added (reflog order), and Recently Changed (by last commit date).
- Adjusts recent-branch loading limits in
GitStorebased on the selected sort mode, and adds/updates unit tests.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| app/test/unit/group-branches-test.ts | Adds coverage for new sort modes and recent-branch capping behavior. |
| app/src/ui/toolbar/branch-dropdown.tsx | Threads branchSortOrder prop into branch dropdown rendering. |
| app/src/ui/repository.tsx | Passes branchSortOrder down into repository view children. |
| app/src/ui/preferences/preferences.tsx | Adds branchSortOrder to preferences state and persists via dispatcher. |
| app/src/ui/preferences/appearance.tsx | Adds Appearance UI for selecting branch sort order. |
| app/src/ui/history/compare.tsx | Passes branchSortOrder into compare sidebar branch list. |
| app/src/ui/dispatcher/dispatcher.ts | Adds dispatcher API for updating branch sort order. |
| app/src/ui/branches/group-branches.ts | Implements new grouping/sorting behavior based on sort order. |
| app/src/ui/branches/branches-container.tsx | Threads branchSortOrder into BranchList. |
| app/src/ui/branches/branch-list.tsx | Updates group header labeling based on sort order. |
| app/src/ui/app.tsx | Passes app state branchSortOrder into relevant UI surfaces. |
| app/src/models/branch-sort-order.ts | Adds the sort order model/default. |
| app/src/lib/stores/git-store.ts | Adds sort-dependent recent-branch limits and extends loadBranches. |
| app/src/lib/stores/app-store.ts | Persists the setting, reloads branches on change, and wires into initial load. |
| app/src/lib/app-state.ts | Extends global app state with branchSortOrder. |
You can also share your feedback on Copilot code review. Take the survey.
| bitbucket: `${htmlURL}/pull-requests/new?${param( | ||
| 'source', | ||
| encodedCompareBranch | ||
| )}&${param('dest', encodedBaseBranch)}`, | ||
| github: `${htmlURL}/pull/new/${ | ||
| encodedBaseBranch ? encodedBaseBranch + '...' : '' | ||
| }${encodedCompareBranch}`, | ||
| gitlab: `${htmlURL}/merge_requests/new?${param( | ||
| 'merge_request[source_branch]', | ||
| encodedCompareBranch | ||
| )}&${param('merge_request[target_branch]', encodedBaseBranch)}`, |
There was a problem hiding this comment.
Why did you change the formatting in these lines? There doesn't seem to be any content changes.
There was a problem hiding this comment.
I've run prettier locally and it has changed the lines. GitHub Copilot then commented on the formatting, so not really sure what happened. I can revert.
There was a problem hiding this comment.
That's strange, PR_URLS has a // prettier-ignore comment, so it should be ignored...
I added that exception because these constructed URLs become practically unreadable when formatted.
| * The max number of recent branches to include for non-alphabetic | ||
| * sorts where full "recent" list ordering is required. | ||
| */ | ||
| const RecentOptionsBranchLimit = 2500 |
There was a problem hiding this comment.
2500 seems like an arbitrary limit, and some repos can have way more branches. There should be no limit.
I think that the current approach of just extending the "Recent branches" section is flawed. It would be much better to just hide the "Recent branches" section and change the sorting of the "Other branches" section. This might give you the grouping of local branches at the top (see my first comment) "for free".


Description
Hi! Thanks for maintaining this. I love it.
What I also love is the "Recent branches" list. Especially with AI, I try multiple things at the same time. So just showing 5 is not enough. I thought about adding a setting that changes the amount of branches that are displayed in "Recent branches", but I figured: It's much more useful to either sort by recently added (what "Recent branches" currently does), or new, "Recently changed" (based on commits).
Screenshots
Release notes
Notes: