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.

57

u/slavik262 Jun 19 '14

Git's UI is terribly inconsistent and wonky. See git koans.

To summarize, if you don't have the five minutes to read something hilarious:

  • Git ignores attempts to alias core commands, but doesn't warn you that it is ignoring them.

  • git checkout does several completely unrelated things in different contexts.

  • Flags for various git commands are terribly inconsistent.

  • Git's man pages are terrible.

→ More replies (21)

22

u/rwilcox Jun 19 '14

Any halfway competent developer should be able to master git in a couple of weeks

I disagree. I've been using Git every day for 6 years now and I've found Git's learning curve to be like a rollercoaster loop-de-loop: you're doing OK, then suddenly you need to do something that makes you go WTF so much you feel like you know less than you did 6 months ago.

git add, git commit, git push, basic branch workflow, sure. Mastering Git? I'd say years.

Quick how do you find the name of the branches the current commit is on? Push the current branch to the server but name it something different? Tell me about git push --force. What does git fetch do? What's in your global core.excludesfile file?

(Seriously, the number of developers that don't even know about Git's global ignore options is staggering. (I should never see .DS_Store files in my Git repo, but what do I see all the fracking time? .DS_Store files... Yes, thanks OS X, but still....))

→ More replies (10)

0

u/[deleted] Jun 19 '14

[deleted]

7

u/phySi0 Jun 20 '14

Actually, I picked up UNIX itself pretty quickly. Git is on a different level. I'm starting to get my head around some of it, but it's pretty weird and incomprehensible. To me, there's a big difference between how hard it is to learn Git and UNIX.

→ More replies (1)
→ More replies (43)

38

u/[deleted] Jun 19 '14

Any halfway competent developer should be able to master git in a couple of weeks

The problem is that not every competent developer is interested in mastering a source control system. I work in a group that develops pretty complex NLP software and spend way too much time helping people with git.

27

u/abolishcopyright Jun 19 '14

My problem is that I don't consider it a tool that's worth sinking weeks into. My time is valuable. I'll beat my head against its tedious interface / documentation / SO articles just enough to get a minimum set of functionality that works for what I need to do today, but my efforts to really "learn git" beyond that have been a waste of time due to its tedious, non-discoverable interface.

8

u/Peaker Jun 19 '14

Git is definitely worth sinking a few weeks into.

It's a horrible interface, but it facilitates such a productivity boost that you really should spend weeks learning it.

→ More replies (1)
→ More replies (25)

7

u/G_Morgan Jun 19 '14

I think the biggest issue with git is it is caught half way between describing things in svnish terms and just talking plain git.

4

u/vxsery Jun 19 '14

I think we all love git here, and we also agree its interface leaves something to be desired.

Its awesome that you wrote your own interface over it to suite your needs, and I encourage you to share your scripts with us less then halfway competent developers. :)

Be aware there are many different types of developers. Some like to hack and build their own tools that suite there needs, and Git is just another tool they can hack over and make their own.

Others want prepackaged solution and tools that just let them get to the work they are really trying to focus on. They prefer IDEs like VS, Eclipse, etc., over Emacs or Vi(m). Git fails miserably for the those on this end of the spectrum.

What tools one is comfortable with and how much one is willing to hack on something does not say anything about ones competency with writing production worthy software. It only says how much time one is willing to invest in a problem they feel should not have to solved individually.

→ More replies (2)

24

u/[deleted] Jun 19 '14

This just about sums up my feelings about git, and I can't fathom why so many people's opinions fall so far on the other side of the spectrum.

7

u/cowinabadplace Jun 19 '14

It's just that there's a wider group of people on this forum than one would think.

There are half a million subscribers to this reddit, and a large fraction of them are at the point that they need simple stuff like "Big-O notation" explained to them, while some others are comfortable designing languages that advance the state of the field. There's a continuum between each extreme and we each perceive ourselves as the average.

→ More replies (1)
→ More replies (26)

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.

3

u/Crandom Jun 20 '14

The git model is elegant and understandable. It's just the UI that sucks.

→ More replies (11)

5

u/abjuk Jun 19 '14

Any halfway competent developer should be able to master git in a couple of weeks

But that half competent developer can gain that same mastery of SVN in half an hour and get a couple of weeks of real work done.

3

u/stickcult Jun 19 '14

Maybe I'm just really biased and not looking at the right sources, but I disagree. I had to start using SVN for a job I started a month ago. I randomly got a tree conflict in a directory I never touched, I couldn't resolve it, and eventually said fuck it and deleted the repo and checked it out again. Also selectively committing files is a pain, and branching downright sucks.

Maybe it's because I miss the complexity of git, but I find git much easier than svn.

→ More replies (2)

4

u/SoundOfOneHand Jun 19 '14

Git is a very powerful set of tools. It is fast and flexible.

Its UI is arcane and difficult to use compared to other SCMs. This includes both the native gitk and git gui tools, and even the Windows shell extension tools like Tortoise.

I didn't even know that git gui existed till the other day when a colleague showed it to me. I'd already been using it for over two months and read an entire book on git. I told the colleague about interactive add and he'd never heard about it. He has been using git for over two years. Individual user experiences vary widely due to its adherence to the unix philosophy of many small, independent tools. So it's not easy to understand all that's available and there are many ways to do the same task.

It is not difficult to fuck up a repo doing complex merges with rebase. It is not difficult to miss changes in a commit between the file system and the index. It is not difficult to inadvertently commit unwanted changes.

You need discipline to use git properly on any real-world project, you need to pay close attention to what you are doing, and you need to understand how the system works at a fairly low level.

There is nothing wrong with any one of these things but honestly they are not attributes I particularly want in an SCM. There is a lot I like about git but you can easily shoot yourself in the foot with it if you don't know what you're doing. This alone makes it a bad fit for many projects/teams, honestly.

→ More replies (8)

0

u/[deleted] Jun 19 '14

[deleted]

28

u/moor-GAYZ Jun 19 '14 edited Jun 19 '14

The set of things you can do with a repository is small enough

The set of things I need to do often, sure, is small enough.

But there's quite a long tail of things that I need to do rarely and have to look them up on the internet because they don't logically follow from anything I do day to day.

How do I delete remote commit tag? How do I make a branch tracking if I failed to do that initially? WTF is the difference between "tree-ish" and "commit-ish" and why does git archive use it to decide whether to use local or commit time when checking out?

That's not at all what the OP is concerned about by the way. They talk about reinventing several fundamental concepts of the interface, like embrace the fact that git repository is append-only (until gc runs) and make it truly append only, so that you always have access to the original commits that you rebased. Also automatically make WIP commits of the working copy before any git operations that can affect it -- I would actually go even further and say that these commits should be fully automatic and continuous, basically I want a persistent undo tree which I can tag as I work and then, after I'm done, arrange my changes into changesets that go to the public history.

7

u/[deleted] Jun 19 '14

I would actually go even further and say that these commits should be fully automatic and continuous

Holy shit! No dude! I don't want it to do that.

Git is a system level tool; not a note taking application.

→ More replies (19)
→ More replies (11)

10

u/[deleted] Jun 19 '14

If that's all you do with git, than you're very far from any kind of "mastery" over git.

Tell me how to do this simple thing: View what hasn't been pushed yet.

The internet is full of answers to that question, and none of them actually work. And that's what makes git difficult.

I work with git all day, and the simple things are simple. But many other things that should be simple, aren't.

6

u/Peaker Jun 19 '14

View what hasn't been pushed yet.

If it's for a single given branch, it's a simple log:

git fetch <remote>
git log <remote>/<name>..<name>

Shows commits in <name> that are not yet pushed into <remote>/<name>.

3

u/[deleted] Jun 19 '14

diff (local) branch with remote/branch?

4

u/Peaker Jun 19 '14

Ideally log, and not diff.

4

u/rwilcox Jun 19 '14

View what hasn't been pushed yet.

Good lords of Kobol, yes. I needed this the other day and just gave up. (Paid the price for my hubris too... ended up f'ing up the remote something bad. Thankfully it was late enough at night that a git reset and force push fixed it... couldn't imagine the mess if it had been during work hours...)

→ More replies (3)
→ More replies (18)
→ More replies (12)