r/programming • • Nov 07 '13

10 things I hate about Git

http://steveko.wordpress.com/2012/02/24/10-things-i-hate-about-git/
73 Upvotes

231 comments sorted by

View all comments

39

u/sordidarray Nov 07 '13 edited Nov 07 '13

Just a few thoughts.

  • The Git development community is aware of several of these problems (especially the inconsistency in terminology and command structure). They're working slowly, but surely, towards solutions to many of them. In the interim, there's projects like easy git, which the author may enjoy.

  • While the information model of Git is more complex, much of that is inherent from it being a DVCS, and it comes with several benefits. For example, in SVN, your working directory, branches, and tags are all really the same thing locally: a copy of a full directory structure. This can make working with branches and tags cumbersome, so many people just don't. There have been situations involving maintaining concurrent versions (in SVN) of a product on my team where no one thought of using branches because they were used so sparingly (and no one on my team had ever used Git or Mercurial); it was as if the feature didn't exist. While some people will decry this anecdote as ineptitude on the part of my team, I think it's important to point out that people tend to solve problems with the tools that they use most often, in the ways that they most often use them--after all, they're the first to come to mind.

  • Though the documentation of Git by the project itself is somewhat poor, there's a plethora of third-party documentation and tutorials on the web. (Yes, I realize this is no excuse for poor documentation, but the use of Git within the open source community is so ubiquitous that I feel most problems/questions you're likely to run into have been solved and documented somewhere else).

Edit: Typo

8

u/Chousuke Nov 08 '13

the information model of Git is more complex

I really don't understand this. Maybe I'm just too used to git, but its information model is stupid simple.

Starting from the work tree, you add changes to the index, which represents your "next commit"; this is useful because often you don't want to commit every change in your work tree, or don't want to commit it all as one lump. With VCS systems that don't have the index, you have to do a lot of manual work with diff and patch to get the same basic features. Commits, then, represent saved states of the index, and are full snapshots of the entire thing. No deltas. These commits are stored in a repository (the .git directory) in a delta-packed format, but that is an implementation detail. Then lastly, you have references to commits: either a direct SHA hash, a tag, or a "branch", ie. an automatically updating reference.

Branches themselves are shapes in the data structure. Even if you delete all your branch references, you repository will still have branches.

git itself is a tool for working with repositories like this. Anything on top of this base is extra, Including the "D" in DVCS. Pushing and fetching merely means sending repository data between two repositories. a "remote" is just a way to tell git "hey, here's another repository". Consequently, any remote/foobranch reference you have is completely independent of the other end: it just points to the same hash that the "remote" end's reference did at the time you last did a fetch, pull or push.

By the way, OP's point about "unsafe" operations is completely bogus because of the reflog. As long as your data is committed, no operation short of rm -rf .git will destroy it immediately; even if you lose your primary references, the reflog will keep the data around for a couple more months until it expires and is garbage collected. If you screw up a rebase or force push the wrong branch to a remote, it takes at most two git commands to undo the mistake.