r/programming • • Jun 19 '14

Reinventing GIT interface

http://tonsky.me/blog/reinventing-git-interface/
221 Upvotes

325 comments sorted by

View all comments

44

u/[deleted] Jun 19 '14

I guess I'm alone in finding git not that hard to use. My only issue is git isn't pretty and to that end I have a few scripts to give me prettier logs (like most people have) and prettier branch summaries (my macro displays all branches, their latest commit id and dates).

Beyond that I manipulate my tree with straight up git commands.

Any halfway competent developer should be able to master git in a couple of weeks let alone be able to write their own version of git given a couple of full time weeks to work in.

15

u/huyvanbin Jun 19 '14

See, I think development tools should be pretty. If your job is to design an elegant, understandable software system, what does it say that your tools don't meet the same criteria? Were they made by worse developers than you are? Did they just not care enough? Etc. To me the Unix mentality just saps my energy every time I encounter it and makes me want to go do some woodworking or something else that doesn't make me face the accumulated stupidity (or indifference) of generations of programmers.

1

u/[deleted] Jun 19 '14

The unix mentality is powerful if you know how to use it.

E.g. doing something like piping the output of grep through sed or awk to format some output is useful as opposed to waiting for a single binary program that does all of those random combinations.

The problem is we have a generation or two of "developers" who are nothing more than glorified script monkeys.

10

u/huyvanbin Jun 19 '14

I had a similar thread here and still feel a sufficiently bad taste to not want to rehash those arguments. But I'm not saying anything about the glories of piping grep to sed, I'm talking about things like inconsistent or unintuitive arguments. By your own admission git is not pretty and my argument is that this is a nontrivial flaw. There is a thing called The Unix Haters Handbook which probably makes these arguments more masterfully than I could.

2

u/[deleted] Jun 19 '14

Ya but "pretty" is relative. The way I have my .bashrc setup is probably different than yours. That's kinda the upside of the unix philosophy.

I mean unless you want to "OBEY" and have everyones workstation look exactly the same ala MacOS or Windows...

0

u/loup-vaillant Jun 20 '14

Ya but "pretty" is relative

Not always. There are objective criteria, such as orthogonality, size of the interface etc. that are very closely associated with the subjective impression of prettiness.

The grep and sed command for instance both use regular expressions. It would not be pretty of them to use different kinds of regular expressions: the effort I undertook to learn one command should be portable to the other. I was very happy to see how similar the two commands are. I was less happy to see that both grep and egrep existed, and to this day, I can't recall the differences of the top of my head.

Git on the other hand… What's up with being able to create a branch with both git branch and git checkout -b? That's… well, ugly. And it also means that millions of programmers will need to spend more time learning those commands. They will learn, but frankly, they shouldn't have to. I understand the need for short-cuts, but this is way overdone.

0

u/[deleted] Jun 20 '14

checkout -b is meant to move to the branch after making it. It's no more the "right" way to do it than

git branch foo && git checkout foo

So if you really can't remember the -b option then don't use it.

By this logic "gcc" is the most overloaded command in history... how do you assemble a .s file?

 gcc foo.s -o foo.o

How do you compile a c file?

gcc -c foo.c -o foo.o

How do you compile a C++ file?

gcc -c foo.C -o foo.o

... this is SO CONFUSING!!!

0

u/loup-vaillant Jun 20 '14

Well, there is a logic to it: those examples are all about generating an object file. There is something funny, though: I don't see any "-c" flag in your first example. It should be there to signal you want an object file, instead of a full executable. Did you forget it, or is it a genuine inconsistency with gcc?

I know what checkout -b is meant to do. The problem isn't that I can't remember what the command does. Man pages are enough for that. The problem isn't even that I can't remember how to create a branch, then move to it: 'cause if I can't remember the primary purpose of git branch and git checkout, I'm hopeless as a programmer.

There are two problems:

  1. It's one more option to document. It takes visual space, it takes time to read, and it doesn't help when you want to read anything else.

  2. It's surprising: checkout is supposed to have an effect on the working copy only. checkout -b also affects the repository.

I reckon it's not much. And I'm only a beginner, so this is the only example I can think of of the top of my head. But from the volume of complaints I hear about Git's user interface, I guess there are many other such examples. They add up.

0

u/[deleted] Jun 20 '14

You can fully use git as intended without ever doing "git checkout -b" ... that's the point. Sure it's odd that the checkout command can also create a branch but it's a useful shorthand since git is meant to be used with rapidly created branches.

1

u/loup-vaillant Jun 20 '14

You do not get my point. Even If I don't use that command it, that's a couple more lines in a documentation I often skim for other purposes. If it wasn't there, the rest would be that much easier to discover.

→ More replies (0)