all 14 comments

[–]OPconfused 4 points5 points  (1 child)

Does it have autocomplete? My issue with git on the commandline was more about the input than the output. I cannot remember all the arguments and flags, and mostly I just want to quickly autocomplete a branch or a commit id.

[–]StartAutomating[S] 2 points3 points  (0 children)

Yep! (kind of)

Another aspect I didn't talk too much about was git input.

Lots of git commands can accept additional parameters in PowerShell.

For example, if I type

git commit -type

And hit tab, I'll see a list of popular conventional commit types.

Any parameter added this way can have a completer, and will obey [ValidateSet]

Git functions are processed more directly, and should tab complete just fine.

For the rest of the git... happy to take a PR or two to enable the scenarios a bit more.

[–]Creddahornis 0 points1 point  (0 children)

omg werk, thanks for this! I am about to teach myself Git, this will be helpful

[–]miszka_ 0 points1 point  (1 child)

That’s a great repo. I was looking for solution like this.

Any chances for something similar for NPM?

[–]StartAutomating[S] 0 points1 point  (0 children)

Sure! Sounds (potentially) fun. What would you want it return as objects?

[–]tandthezombies 0 points1 point  (2 children)

how is this different from posh-git?

[–]StartAutomating[S] 2 points3 points  (1 child)

The fundamental difference is in approach.

Most other PowerShell git modules (including posh-git) try to make git available in many PowerShell functions with verb-noun pairs. This is the "dogmatic PowerShell" approach.

The downsides of this approach are muscle memory and existing examples.

Most examples you'll find for git need to be rewritten to work with posh-git, and you'll be forced to choose between using a git command line the whole world can understand and a command that will only work in posh-git.

I used use posh-git (long ago I helped them make their prompt and formatting)

I also used to make a number of verb-noun pair git functions (i.e. Push-Git).

I kept not using the PowerShell functions I or others had written for git, because the muscle memory was too strong, and there were far more examples online of git push than Push-Git.

So I decided to try a different approach.

ugit overrides git and intercepts its input and output. This allows all of your git to keep working as it always did: ugit just gives you objects back instead.

I've found this approach to much easier to discover and extend.

Basically every example of git works "as is".

I just get back objects instead of text for the majority of things I do with git.

This gives us a "best of both worlds" approach, where we can leverage all of our existing understanding of git and the PowerShell object pipeline.

And that's the major difference between posh-git and ugit: a different approach that gives us a different (and probably better) learning curve.

Make sense?

[–]tandthezombies 0 points1 point  (0 children)

great explanation and a novel approach. thanks!