Skip to content

Suggestion: PSProvider for working with Git #47

Open

Description

@omidkrad

Default PSProviders in PowerShell are the followings:

> Get-PSProvider

Name                 Capabilities                                      Drives
----                 ------------                                      ------
Registry             ShouldProcess, Transactions                       {HKLM, HKCU}
Alias                ShouldProcess                                     {Alias}
Environment          ShouldProcess                                     {Env}
FileSystem           Filter, ShouldProcess, Credentials                {C, D, E, F...}
Function             ShouldProcess                                     {Function}
Variable             ShouldProcess                                     {Variable}

I thought it would make sense to have one for working with Git repositories, so that you can do, for example:

Get-ChildItem Git:MyRepo\src\*

and other Git operations with standard PS cmdlets.

Activity

  1. Jaykul commented on Jun 12, 2015

    @Jaykul
    Member

    Can you give some more examples of git actions which you can imagine mapping to a provider?

    For instance, how would you imagine handling the core 6:
    clone
    status
    add
    commit
    push
    pull

    In my head, I immediately thought git clone would map to New-PSDrive ... but that already clashes with your example 😉

  2. jrich523 commented on Jun 12, 2015

    @jrich523
    Contributor

    i had considered this too (once i saw add-item remove-item) but after giving it some thought i realized it wouldnt really work out too well in the end

  3. omidkrad commented on Jun 12, 2015

    @omidkrad
    Author

    I don't think there is an intuitive way to do the main operations. Now that I think more about it I think a PSProvider would be better suited for managing the Git repositories on your computer, rather than Git operations themselves. For example the Git: drive can be your central point for registering and accessing Git repositories on your computer, or on your GitHub account. I think it can work well with Git cmdlets. For example I can imagine the following scenario:

    cd GitHub:PoshCode/PSGit
    dir # list files
    Get-Commit # list commits
    Open-Commit a6eb714 # open commit in GitHub
    Git-Clone . C:\GitHub -register
    cd Git:\
    dir # list registered repos
    dir -directory | where { $_.Remote -eq PoshCode/PSGit }
    

    Difference between using the repository from file system vs Git: drive is that when querying files in the Git: drive you will get get-specific properties, such as SHA, LastModifiedBy, LastCommitDate, History, Lines, IsIgnored, RemotePath, etc.

  4. Jaykul commented on Jun 12, 2015

    @Jaykul
    Member

    Oh, well in that case, you'll be happy to hear that you don't need a git drive to get stuff like that when you query files ... we can detect you're in a git folder and give you stuff like that on your Get-ChildItem output automatically, without needing to register them.

  5. jrich523 commented on Jun 12, 2015

    @jrich523
    Contributor

    yeah, if you look there is a GCI Proxy branch (currently a PR) that shows the change/stage state

  6. omidkrad commented on Jun 12, 2015

    @omidkrad
    Author

    That's great to know. Thank you guys.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions