Skip to content

Allow specifying a ref and path for Git-installed extensions #7808

Closed

Description

@gspencergoog

What would you like to be added?

For extensions installed via git, it would be really helpful to be able to specify the ref/branch/tag and sub-path for where to install an extension from.

I'd suggest having two arguments to gemini extensions install which allows providing the ref (which can also be a branch or tag), and/or path.

For example, I'd like to be able to do this:

gemini extensions install --source https://github.com/flutter/ai-guidance.git --ref beta --path gemini-cli/extensions/flutter

Of course, --ref and --path are only valid for Git sourced extensions.

The .gemini-extension-install.json would then contain:

{
  "source": "https://github.com/flutter/ai-guidance.git",
  "ref": "beta",
  "path": "gemini-cli/flutter",
  "type": "git"
}

Installing it would be a sparse fetch that only includes the path specified, moved to the root of the checkout, which could be the equivalent of:

git archive --remote=<repo_url> <ref> <path/to/dir> | tar -x

Updating the install would fetch the ref HEAD. If the ref is a branch, it would fetch the latest HEAD, if it is a tag, it will fetch the ref that the tag now points to, and if it's just a fixed ref, it would re-fetch the files at that ref and overwrite them. before fetching, any existing files in the extension would need to be removed, so that removes would also be supported.

We might have to save a manifest in the .gemini-extension-install.json or another file so we know what files to remove, because a user could add their own files, and we don't want to just nuke the directory, do we? If we're OK with just nuking the extension directory before re-install, then that works as well.

We can't make the extension directory be an actual Git repo because

  1. sparse checkout doesn't support checking out the files to a location other than their actual relative location, and
  2. even though the checkout is sparse, the whole git repo (at least the latest commit) would have to be synced to the .git, which could be larger than the user is expecting (imagine using a path inside of the Flutter repo for an extension).

(related to Ithis issue )

Why is this needed?

I'm authoring an extension for Gemini CLI, but I don't want to make a completely separate repo to hold it: I'd like to add it to an existing repo. Without the ability to specify a sub-path, I can't do that. And my users can't pin the extension at a particular version without being able to specify a ref, branch and/or tag. Also, even if I'm fine with making a whole repo for each extension, it can contain a lot of boilerplate that the extension doesn't need (README.md, any other rules files I have there for other agents, git actions, etc.), and can confuse things. And allowing specifying of a branch/ref/tag helps users manage the channel they are on.

Additional context

No response

Activity

  1. added
    status/need-triage
    on Sep 5, 2025
  2. added
    priority/p2
    and removed
    status/need-triage
    on Sep 5, 2025
  3. gemini-cli commented on Sep 5, 2025

    @gemini-cli
    Contributor

    This is a well-defined feature request to enhance the Git extension installation process by adding support for specifying a ref and a sub-path. This falls under area/extensibility and is classified as a kind/enhancement. The priority is set to P2 as it is a valuable improvement but not a critical bug.

  4. self-assigned this
    on Sep 8, 2025
  5. removed their assignment
    on Sep 18, 2025
  6. jakemac53 commented on Sep 18, 2025

    @jakemac53
    Contributor

    Unassigned myself, we are not working on sub-path support at this time. The ref support is in though.

  7. gemini-cli commented on Dec 7, 2025

    @gemini-cli
    Contributor

    Hello! As part of our effort to keep our backlog manageable and focus on the most active issues, we are tidying up older reports.

    It looks like this issue hasn't been active for a while, so we are closing it for now. However, if you are still experiencing this bug on the latest stable build, please feel free to comment on this issue or create a new one with updated details.

    Thank you for your contribution!

  8. gspencergoog commented on Dec 8, 2025

    @gspencergoog
    Author

    This is a feature request that is still missing sub-path specification. I got around it by using Github releases that only contain the files I wanted.

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

    Stalepriority/p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions