Skip to content

gh repo list --no-archived impacts sorting for non-default branch pushes #13881

Description

@bburns-ds

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

  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.

...  # 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions