Live data from Hacker News

GUM: A better CLI for Git

saintsjd.com

11–20 of 85 posts

Re: GUM: A better CLI for Git

#11
post #9

Where is this GUM or better cli for git? All I see is a README file containing the same thing as the webpost. Not to be a complainer, but there may be a reason the commands are the way they are and you cant simply change them without changing the implementation, perhaps you should look at alias to solve your memory problems.

Is there a reason, or was this just the way the commands evolved? If there is a reason, this would be the perfect time to point it out. Otherwise, what's wrong with improving the UI for everone?

[edit] but yeah, where's the code?

Re: GUM: A better CLI for Git

#12
I've noticed that making the mental switch from writing code to committing it costs quite of bit of time throughout a day of development. A more intuitive interface would remove the need to make the mental switch. This interface feels much more intuitive to me -- great job.

Re: GUM: A better CLI for Git

#13
post #7

This is such a great idea. I'm using Git for my own repositories and I find myself doing searches for things like "how to undo a stage" or "how to revert a file" so often that it almost takes as much time to use Git as it does to do my programming. No doubt Git gods who have every nuance of the system memorized can take advantage of the flexibility of the (IMHO) complicated and obtuse CLI. But for schmucks like me wh…

Not that the git UI doesn't leave a lot to be desired, but git has a nice security blanket:

git reflog

Now you can feel free rebase with abandon.

Re: GUM: A better CLI for Git

#14
post #7

This is such a great idea. I'm using Git for my own repositories and I find myself doing searches for things like "how to undo a stage" or "how to revert a file" so often that it almost takes as much time to use Git as it does to do my programming. No doubt Git gods who have every nuance of the system memorized can take advantage of the flexibility of the (IMHO) complicated and obtuse CLI. But for schmucks like me wh…

Not that the git UI doesn't leave a lot to be desired, but git has a nice security blanket: git reflog Now you can feel free rebase with abandon.

git reflog is the SINGLE most undersold feature of get. It's a global, perpetual undo function (less garbage collection, which I understand to be discouraged).

Re: GUM: A better CLI for Git

#16
Most of this stuff can be done with aliases.

git stage

  git config alias.stage '!f () { if (( $# > 0 )); then git add -- "$@"; else git add -u; fi }; f'
  
git unstage

  git config alias.unstage 'reset --'
  
git undo is too ill-defind to actually implement. Sounds like the author wants it to be `git reset --hard HEAD`, but it's far more dangerous doing that while termed `git undo` than it is while termed `git reset --hard HEAD`, because people will have unrealistic expectations of what it does.

What's wrong with `git rm`? Here's a hint: you don't need to use it. Most people I know just delete the files however they want, and then run something like `git add -u` to pick up the deletions. That's exactly what the author is suggesting, but that's what people do today, so I don't see the issue.

As for git status, there's already a --short (or -s) flag that gives a very terse output. I personally use that all the time with an alias `git config alias.st 'status -sb'`.

Automatic setup? Put that info in the global config file. If git had to prompt for it, it would naturally place that info in the per-repo config file (absolutely would not make sense to automatically modify the global one), and it would be more confusing to users to be constantly re-prompted for name/email (because they switched repos). I don't see the problem with just telling new users to set up name/email globally, which every git tutorial I've seen does.

git switch

  git config alias.switch checkout
For git diff confusion, just use aliases for different commands. Do not make me type STAGE, that's no friendlier to users. I personally run with the following two aliases:

  git config alias.staged 'diff --cached'
  git config alias.unstaged 'diff'
though I rarely use the `git unstaged` command. I also have

  git config alias.both 'diff HEAD'
though I never use this one. Perhaps other names can be chosen that the author likes better.

The bit about deleting branches is misguided. `git remote` is a command that has sub-commands. `git branch` isn't. I understand that the author thinks having two styles of commands is weird, but there's not really a good alternative. Commands like `git remote` that have sub-commands would not work very well at all in the switch model (for a pathalogical example try to imagine what `git svn` would look like this way), and switch-based commands, which is most commands in git (and most commands in UNIX in general) would not do well in the sub-command model.

Re: GUM: A better CLI for Git

#17
post #16

Most of this stuff can be done with aliases. git stage git config alias.stage '!f () { if (( $# > 0 )); then git add -- "$@"; else git add -u; fi }; f' git unstage git config alias.unstage 'reset --' git undo is too ill-defind to actually implement. Sounds like the author wants it to be `git reset --hard HEAD`, but it's far more dangerous doing that while termed `git undo` than it is while termed `git reset --hard HE…

Per "git undo", what about something like:

    git rewind
    git rewind FILE
    
    git rewind --revision=REVISION
    git rewind FILE --revision=REVISION
We already have the "fast forward" metaphor.

Re: GUM: A better CLI for Git

#18
post #16

Most of this stuff can be done with aliases. git stage git config alias.stage '!f () { if (( $# > 0 )); then git add -- "$@"; else git add -u; fi }; f' git unstage git config alias.unstage 'reset --' git undo is too ill-defind to actually implement. Sounds like the author wants it to be `git reset --hard HEAD`, but it's far more dangerous doing that while termed `git undo` than it is while termed `git reset --hard HE…

Per "git undo", what about something like: git rewind git rewind FILE git rewind --revision=REVISION git rewind FILE --revision=REVISION We already have the "fast forward" metaphor.

Interesting idea, though I don't get the need for the --revision flag in your example. It's already pretty easy to tell the difference between revisions and files. If you want to call it unwind, why not just make that an alias for reset?

  git config alias.rewind reset

Re: GUM: A better CLI for Git

#19
post #7

This is such a great idea. I'm using Git for my own repositories and I find myself doing searches for things like "how to undo a stage" or "how to revert a file" so often that it almost takes as much time to use Git as it does to do my programming. No doubt Git gods who have every nuance of the system memorized can take advantage of the flexibility of the (IMHO) complicated and obtuse CLI. But for schmucks like me wh…

> No doubt Git gods who have every nuance of the system memorized can take advantage of the flexibility of the (IMHO) complicated and obtuse CLI.

From what I understand, it's not even that. It's learning the plumbing.

If you check the videos and presentations of the Github guys (mostly schacon), 90% of what he talks about are the implementation details of Git as an object store and the plumbing (the plumbing is the low-level commands dealing pretty directly with the repository's storage formats, porcelain is the set higher-level commands implemented in terms of plumbing).

Why does he do that? Because the porcelain, git's high-level CLI, makes no sense in and of itself. It's inconsistent and weird and ugly and fraught with peril.

But it makes sense in terms of the plumbing, if you know what happens "under the hood" you can make sense of porcelain commands: it remains dreadful, but now it's just a bunch of shortcuts for the sequences of low-level operations you know about.

(as far as I'm concerned, I don't have the patience or the care for git's plumbing, so I just use hg and hg-git to interact with git repos)

Re: GUM: A better CLI for Git

#20
Why this is needed:

Latest blog article over at progit.org: "Reset demystified" http://progit.org/2011/07/11/reset.html

Scott Chacon, author of the the Pro Git book, admits there that he didn't cover the "reset" command in depth in the book because he didn't fully understand it. Go figure...

Post reply on HN