Skip to main content

Some thoughts on Git vs complexity


I originally wrote this in the Git For Human Beings mailing list. The thoughts are stolen from Rich Hickey's Simple Made Easy talk. (Matthew McCullough commented the same parallel the same day, but I think his timestamp was a few hours afterwards). I wanted to tweet about it, but it ended up being a whole post, as I'm trying to gather my thoughts on it for my next Git talk.

There's simple stuff, and there's easy stuff.

Simple means the opposite of complex. Easy, on the other hand, means it's very close to the stuff you already know. Git is "simple" but hard. Subversion is "easy", but eventually complex.

Git is *a lot* of features in one tool (think of the 100+ git plumbing commands). Each feature is simple, but learning to use them together is good bit of work. As soon as you've understood the model and you get that Eureka-moment, the tool never fails you, and you find it more and more fun to use the more you learn. (This is why there are so many git enthusiasts, I reckon.)

Subversion has a very limited set of features.It also turns awfully complex when you want to do stuff like merging. Actually the more I learned about Subversion, and the more I used it, the more frustrating I found it.

Why is Subversion complex?

- Because the stuff on the server is something different from what you have locally. Your local checkout is just a thin skin. All the interaction goes over the network with a really thin and crappy API. It’s like reading a book using binoculars. The same information is there, but it’s horrible to get at it.

- Everybody is tangled together using the same repository. People start making mistakes like committing without updating first. Everyone mis-use trunk as their own sandbox. This is complexity too (everything in one bucket).

- It mixes together committing, and pushing the changes to central. A commit should do one thing, and one thing well, and the reasoning should be in the commit message. Some are refactorings, others are feature-changes.

- Because branches are completely disconnected - there’s nothing that ties them together, except being a lot like each other. That’s how merging in Subversion works: “I assume that these two directories will be very similar”, and if they aren’t, BOOM.

Git, on the other hand, is simple: It all boils down to being three kinds of objects in a graph (commits, blobs, trees), and the rest of it are algorithms that work this data-structure.

Comments

  1. And then there is Mercurial, which does the same thing as Git, but apparently is a lot easier, which is why I would never use Git unless forced to. ;-)

    ReplyDelete
  2. Hi Christian, thanks for commenting!

    Yeah, I think Mercurial retained a much more user-friendly interface from early on. The last two years it seems like Git has caught up a lot on the user-friendliness, while Mercurial has added a lot of features inspired by git.

    I had a nice discussion with Martin Geisler (Mercurial committer) at a conference earlier this year, and we pretty much arrived at that you can do anything in Mercurial that you can do with Git (minus some features of the git reflog, I think).

    Performance-wise, they're as good as equal.

    I ended up focusing on Git because of the SVN-interoperability being better at what I was trying to do at the time. I wouldn't mind switching to Mercurial if the circumstances were different, but now it seems like Git has the lead "out there".

    Is Mercurial easier than Git? I'd say yes, because the branching model is a bit easier to grok coming from centralized VCS. Is it simpler than Git? I'd say it's about the same..

    ReplyDelete
  3. Interesting. I ran across this tangentially (I wrote a site based on my experiences trying to learn Git, and was vanity-surfing for links to it, and noticed this at http://coder.io/tag/git). That's a really useful distinction (simple vs. easy) that I'll have to try to incorporate into my own thinking, so thanks for that!

    You're absolutely right to place Git in the "simple but hard" category. I spent my first year or two flailing around, cargo-culting incantations, and generally wasting a lot of time because I didn't grok the model. Unfortunately, while there are a lot of Git enthusiasts, the number of people who seem to be able to effectively teach others how to experience the Git Epiphany is... rather smaller. ;>

    Feel free to steal anything you find useful from my site (http://think-like-a-git.net), and I'd be happy to compare notes sometime.

    Cheers,
    -Sam

    ReplyDelete
  4. Hi Sam, thanks for commenting!

    I'm already a big fan of your Git guide, came across it some time ago. I really appreciate the style of it, and how it's aimed at beginners. Thanks for creating it!

    ReplyDelete
  5. Thanks for sharing your thoughts, as a git novice I appreciate them. However, I found your use of "simple" versus "complex" somehow confusing. I think Jurgen Appelo has found a helpful interpretation of these terms. Maybe you like it as well :-) http://www.noop.nl/2010/09/simplicity-a-new-model.html

    ReplyDelete
  6. Thanks for commenting Christoph!

    Yeah, I could have tried to write a clearer message, but this post was a bit more thinking-out-loud-writing :)

    Appelo's model is interesting. Thanks for the pointer!

    ReplyDelete
  7. The last two decades it seems like Git has captured up a lot on the user-friendliness, while Sudden has included a lot of functions motivated by git.

    ReplyDelete

Post a Comment

Popular posts from this blog

Managing dot-files with vcsh and myrepos

Say I want to get my dot-files out on a new computer. Here's what I do:

# install vcsh & myrepos via apt/brew/etc
vcsh clone https://github.com/tfnico/config-mr.git mr
mr update

Done! All dot-files are ready to use and in place. No deploy command, no linking up symlinks to the files. No checking/out in my entire home directory as a Git repository. Yet, all my dot-files are neatly kept in fine-grained repositories, and any changes I make are immediately ready to be committed:

config-atom.git
    -> ~/.atom/*

config-mr.git
    -> ~/.mrconfig
    -> ~/.config/mr/*

config-tmuxinator.git  
    -> ~/.tmuxinator/*

config-vim.git
    -> ~/.vimrc
    -> ~/.vim/*

config-bin.git   
    -> ~/bin/*

config-git.git          
    -> ~/.gitconfig

config-tmux.git  
    -> ~/.tmux.conf    

config-zsh.git
    -> ~/.zshrc

How can this be? The key here is to use vcsh to keep track of your dot-files, and its partner myrepos/mr for operating on many repositories at the same time.

I discovere…

Encrypting and Decrypting with Spring

I was recently working with protecting some sensitive data in a typical Java application with a database underneath. We convert the data on its way out of the application using Spring Security Crypto Utilities. It "was decided" that we'd be doing AES with a key-length of 256, and this just happens to be the kind of encryption Spring crypto does out of the box. Sweet!

The big aber is that whatever JRE is running the application has to be patched with Oracle's JCE in order to do 256 bits. It's a fascinating story, the short version being that U.S. companies are restricted from exporting various encryption algorithms to certain countries, and some countries are restricted from importing them.

Once I had patched my JRE with the JCE, I found it fascinating how straight forward it was to encrypt and decrypt using the Spring Encryptors. So just for fun at the weekend, I threw together a little desktop app that will encrypt and decrypt stuff for the given password and sa…

The End of GitMinutes (my podcast)

I'm just about ship GitMinutes episode 46, which is going to be the final episode. I'll just paste the outro script here, as it sums up the sentimental thoughts pretty well:

I’m happy to have finally finished [publishing the last episodes from Git-Merge 2017], just in time before Git-Merge 2018 takes place in March. I won’t be going there myself, so I’m counting on someone else to pick up the mic there.

It’s sad to be shipping this one as it is probably the last GitMinutes episode ever. To go a bit down memory lane, 6 years ago, my daughter was born, and as I used a little of that paternity leave to set up my podcasting infrastructure and produce the first few episodes. Initially it was just going to be 10 episodes and call the experiment finished. Instead, I got to 46 episodes, the last dozen or so lazily tailing the last few Git-Merge conferences.

To every one of my guests, thank you so much again for coming on to share your passion in this little niche of computer science a…

Joining eyeo: A Year in Review

It's been well over a year since I joined eyeo. And 'tis the season for yearly reviews, so...

It's been pretty wild. So many times I thought "this stuff really deserves a bloggin", but then it was too inviting to grab onto the next thing and get that rolling.

Instead of taking a deep dive into some topic already, I want to scan through that year in review and think for myself, what were the big things, the important things, the things I achieved, and the things I learned. And then later on, if I ever get around to it, grab one of these topics and elaborate in a dedicated blog-post. Like a bucket-list of the blog posts that I should have written. Here goes:
How given no other structures, silos will grow by themselves This was my initial shock after joining the company. Only a few years after taking off as a startup, the hedges began growing, seemingly almost by themselves, and against the will of the founders. I've worked in silos, and in companies without the…

Working in Teams over Working as Individuals

I recentlypostedthis sketch on Twitter:

Thanks to a few mighty retweets, it gathered a lot of views (9000 impressions, whatever that means). While that's fun and all, I still felt a bit sad that such an awfully simple insight can garner much more popularity than a thorough blog post that I put some hours into.

So, rather than let Twitter get away with this, I'll steal my own content back into the blog :)

The thread went like this:

Pondering how to battle individualism in companies. For some, it is counter-intuitive that teams can be more responsive, faster and even more accountable than single individuals.

Having "teams" in place is no guarantee that team work is happening. Be wary of too large teams, "I/me/mine", personal contact details instead of team point of contact. Good team is sailing crew, not galley slaves.

Beware heroes, go-to persons, calling in favors and other shadow handling of work. Real teams make the work explicit, both requests/needs and re…