Repository navigation
Agent suggestions
Public previewDescription
Describe the bug
Briefly: gh repo list sorts by most recent update to any branch, while gh repo list --no-archived sorts by most recent update to the default branch only, but both display the date of the most recent update to any branch, leading to confusing behavior.
After pushing a commit to a non-default branch, gh repo list correctly moves the repository to the top based on its displayed UPDATED value. However, gh repo list --no-archived displays the same, correct UPDATED value, but the item appears in the same position it appeared in before the new commit.
Consequently, the --no-archived output is not sorted by the UPDATED values it displays, which is inconsistent with the default behavior of gh repo list. Notably, the sorting places the repo based on the last update to the repo's default branch.
Affected version
gh version 2.96.0 (2026-07-02)
https://github.com/cli/cli/releases/tag/v2.96.0
Steps to reproduce the behavior
- Fork
cli/scoop-gh. - Clone the fork.
- Create a non-default branch named
test. - Make and commit a change on
test. - Push
testto the fork. - Run
gh repo list. - Run
gh repo list --no-archived. - Compare the position of
scoop-ghin the two outputs.
Expected vs actual behavior
I expect gh repo list to have the same sorting with and without the --no-archived flag, but for the archived entries to just drop from the list.
gh repo list behaves as expected, sorting by UPDATED. gh repo list --no-archived has unexpected behavior, displaying UPDATED correctly but instead appears to sort repos by UPDATED for the default branch (not displayed).
Logs
Unrelated repositories have been omitted. Two unrelated repository names and their descriptions have also been anonymized.
... # fork is made
❯ gh repo list
Showing 7 of 7 repositories in @bburns-ds
NAME DESCRIPTION INFO UPDATED
bburns-ds/repo1 private about 27 days ago
bburns-ds/repo2 private about 7 months ago
bburns-ds/scoop-gh [DEPRECATED] scoop packaging for the github cli public, fork about 3 years ago
❯ gh repo list --no-archived
Showing 7 of 7 repositories in @bburns-ds
NAME DESCRIPTION INFO UPDATED
bburns-ds/repo1 private about 27 days ago
bburns-ds/repo2 private about 7 months ago
bburns-ds/scoop-gh [DEPRECATED] scoop packaging for the github cli public, fork about 3 years ago
... # repo is cloned, branch is made, commit is made on branch, change is pushed
❯ gh repo list
Showing 24 of 24 repositories in @bburns-ds
NAME DESCRIPTION INFO UPDATED
bburns-ds/scoop-gh [DEPRECATED] scoop packaging for the github cli public, fork less than a minute ago
bburns-ds/repo1 private about 27 days ago
bburns-ds/repo2 private about 7 months ago
❯ gh repo list --no-archived
Showing 7 of 7 repositories in @bburns-ds
NAME DESCRIPTION INFO UPDATED
bburns-ds/repo1 private about 27 days ago
bburns-ds/repo2 private about 7 months ago
bburns-ds/scoop-gh [DEPRECATED] scoop packaging for the github cli public, fork less than a minute ago
Activity
cli-triage commentedon Jul 14, 2026
This looks like a confirmed bug:
gh repo list --no-archiveduses a different sort key (last update to the default branch) thangh repo list(last update to any branch), even though both commands display the sameUPDATEDvalue (any-branch). The result is that--no-archivedoutput appears sorted inconsistently with the timestamps shown. I'm suggestingbugandpriority-3— it's a real behavioral inconsistency with clear reproduction steps, but it doesn't prevent core functionality and a workaround exists (omit--no-archivedand filter manually). No duplicates were found for this specific issue.babakks commentedon Jul 22, 2026
Thanks for reporting this, @bburns-ds! 🙏
The root cause is
repo listuses a different GraphQL query (i.e.search) when certain flags (like--no-archived) are provided:gh repo list: (note the ordering:orderBy: { field: PUSHED_AT, direction: DESC })gh repo list --no-archived: (note the ordering:sort:updated-desc)So, this confirms your observations.
I know it can be confusing but I'm not really comfortable with adjusting this behaviour, as it's been there for a long time and changing it could breaking for users who rely on either orderings.
Before closing this, can you please share more about your workflow and tell me about how this ordering issue affects your experience? It'd be helpful if we have more context.
williammartin commentedon Jul 22, 2026
@babakks if we're concerned about backwards compatability, could we support a flag to allow stable results? It can be achieved with
--jqbut that's a lot of extra complexity for anyone.babakks commentedon Jul 22, 2026
Yeah, that's what I was thinking about and checked API support around it. The problem is
user.repositoriesquery supports both pushed-at and updated-at, but the search query'ssort:qualifier doesn't seem to have a documented pushed-at (checked via GUI autocomplete suggestions).bburns-ds commentedon Jul 22, 2026
@babakks hey thanks for checking this out.
this makes sense to me
I am not scripting with this or using it as a subroutine. I default to using
--no-archivedbecause I aggressively archive repos and dislike that archived repos are shown in the GitHub website repo list by default / don't want to have to filter every time. However, because I am mostly pushing to branches and PRing in, it's just unintuitive to me that if Ipushthengh repo listthat what I just pushed to might not even appear because it might be outside thelimitI set / filter.I recognize that it's better to not break what existing (more power-y) users are doing and so recognize that it's probably best to keep the existing fork in behavior.
babakks commentedon Jul 24, 2026
Thanks for sharing, @bburns-ds! 🙏
An optional flag to explicitly selecting the ordering would be a good addition, but as I mentioned there's no documented option for sort by pushed-at when using the
searchquery from GraphQL (docs).So, I'm labelling this as an enhancement request blocked by platform capabilities.
github-actions commentedon Jul 24, 2026
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.