Skip to content

Include the gh co alias in the gh pr documentation #4789

Closed

Description

@johnbillion

Describe the feature or problem you’d like to solve

While reading the comments on #1303 I discovered that a default alias of gh co is included which maps to gh pr checkout, a command that I use regularly. This alias is not included in the documentation for gh pr or gh pr checkout and I wasn't aware of the alias feature.

Proposed solution

When a user is reading the documentation for gh pr or gh pr checkout, the gh co alias should be mentioned too. There are a few places it could be added:

  1. In the Examples section of gh pr:

    EXAMPLES
      $ gh pr checkout 353
      $ gh co 353
      $ gh pr create --fill
      $ gh pr view --web
    
  2. In the Usage section of gh pr checkout:

    Usage:  gh pr checkout {<number> | <url> | <branch>} [flags]
            gh co {<number> | <url> | <branch>} [flags]
    

Activity

  1. mislav commented on Nov 23, 2021

    @mislav
    Contributor

    Hi, thanks for suggesting this, but I don't think we should hardcode co into the documentation because co isn't guaranteed to be present.

    When you first set up GitHub CLI on a machine, the co alias is added as the only default alias. You can inspect it with gh alias list, you can override it to something else, or you can remove it. Furthermore, if you're authenticating via environment variables like GITHUB_TOKEN (for example in an isolated CI job), the default gh config file might not even get generated, and thus the default alias will not be present.

    Because of all this, it would be incorrect to document the presence of co as if it was fact. It's there both as an example and added for convenience, but it should ideally be discovered by users through interacting with their gh setup at runtime and not via the static documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions