`gh repo list --no-archived` impacts sorting for non-default branch pushes
- Dominant language
- Go
- Stars
- 46.3k
- Forks
- 9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 89
Description
### 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
```text
gh version 2.96.0 (2026-07-02)
https://github.com/cli/cli/releases/tag/v2.96.0
```
### Steps to reproduce the behavior
1. Fork `cli/scoop-gh`.
2. Clone the fork.
3. Create a non-default branch named `test`.
4. Make and commit a change on `test`.
5. Push `test` to the fork.
6. Run `gh repo list`.
7. Run `gh repo list --no-archived`.
8. Compare the position of `scoop-gh` in 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.
```text
... # 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
```
Contributor guide
Assessment
This issue has not been assessed yet.