Skip to content

A gh command to copy a file from a repo without being in a local repo context #4706

Closed

Description

@Ameausoone

Describe the feature or problem you’d like to solve

It would be handy to be able to copy a file from a repo, without checkout repo locally.

Proposed solution

Like this :

gh cp gh:owner/repo/src/subdir/my-interesting-file.txt . 

Additional context

Add possibility to choose branch, tag, or commitId.

Activity

  1. added
    enhancement
    on Nov 8, 2021
  2. Ameausoone commented on Nov 8, 2021

    @Ameausoone
    Author

    (Awesome job BTW)

  3. mislav commented on Nov 8, 2021

    @mislav
    Contributor

    Thank you for the request! I do not believe this feature would be core material, as it's too specific. It's also trivial to do yourself over GitHub API:

    gh api -H 'Accept: application/vnd.github.v3.raw' "repos/{owner}/{repo}/contents/PATH" > ./LOCAL-FILE

    Here, I've made you an extension for this: https://github.com/mislav/gh-cp

  4. Ameausoone commented on Nov 8, 2021

    @Ameausoone
    Author

    Whooo ! Thx @mislav, I discover gh extension !

  5. added
    extension-idea
    on Jan 31, 2022
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

    enhancementextension-idea

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions