A lot of these are just plain wrong though or have a good reason and it makes me sad because I know Steve Losh uses a lot of Mercurial which I think has a much worse UI. 1. Silence: you can't alias built-in commands — for good reason. You don't change the defaults of commands, that's just going to cause problems with scripts. Why is it ignored silently? For starters because new git versions can add a command that wou…
1. If a new version of git adds a command that shadows one of your aliases, you'd really prefer "git foo" to silently run the new command? That's better than telling you "hey this isn't going to do what you think any more"? Do you have `try: foo except: pass` in your Python code too? Come on. There's no reason git shouldn't at least warn you on stderr here. 2. `git checkout -- somefile.py` does not have anything to d…
Git koans
51–60 of 143 posts
Re: Git koans
#52Has anyone made an alternative interface for git that tidies this up without drastically changing how you use git? Or would this condemn someone's sanity to the graveyard?
Re: Git koans
#53The 'Only the Gods' one seems weird to me; maybe I just don't understand Git well enough, but it seems like that one's just a case of failing to understand what a branch is . A particular commit isn't made 'on' a branch, so to speak; it's just a SHA hash that has a particular SHA as a parent. And then a branch is a pointer to a particular SHA. So there's no way to know which branch a commit originated 'on', merely wh…
Although in implementation, a commit is not done on a branch, for the user, that is precisely what happens. You checkout a branch and you do a commit while on that branch. Thus, to the novice, it might be perfectly normal to expect Git to tell him what branches the commit was made on , even though that makes no sense from Git's point of view. I've never had that use case (knowing what branch a commit was made on ), b…
Git is revolutionary, in part, because instead of asking "what's the mental model we want to emulate and then never mind if that matches the implementation", they gave developers credit that they can understand a handful of simple concepts and made the actual design and data model as simple as possible. Programmers know what pointers, SHA-1 hashes, and DAGs are, so just use them.
Re: Git koans
#54Re: Git koans
#55Earlier quoted context omitted.
> I learned hg before git and the experience of switching to git was shockingly bad. I'm comfortable in both now and the big thing I'd miss if I went back to hg would be git stash (and I'm sure there's a hg plugin for it). What about the index? Or the branching (bookmarks kinda work now I think), or the better remote management?
I personally hate the index. It gets in my way far more often than I actually make use of it.
Re: Git koans
#56Re: Git koans
#57The best part of this article IMO is the scrolling header on the left hand. Nice touch.
Re: Git koans
#58The 'Only the Gods' one seems weird to me; maybe I just don't understand Git well enough, but it seems like that one's just a case of failing to understand what a branch is . A particular commit isn't made 'on' a branch, so to speak; it's just a SHA hash that has a particular SHA as a parent. And then a branch is a pointer to a particular SHA. So there's no way to know which branch a commit originated 'on', merely wh…
Most developers think of branches as something they commit to. Therefore they are surprised when later they can't tell which branch they committed to.
This could trivially be fixed with porcelain that puts the name of the branch the commit was made to at the end of the commit message.
The issue of branches not really being branches is not unique to git; most VCs I've ever used have had significant differences between what you would think of as a branch and actual branches (SVN doesn't even have branches, except as a convention).
Re: Git koans
#59Earlier quoted context omitted.
Although in implementation, a commit is not done on a branch, for the user, that is precisely what happens. You checkout a branch and you do a commit while on that branch. Thus, to the novice, it might be perfectly normal to expect Git to tell him what branches the commit was made on , even though that makes no sense from Git's point of view. I've never had that use case (knowing what branch a commit was made on ), b…
Branches are just mutable pointers to commits. You're imposing a mental model onto Git that simply isn't present. Git is revolutionary, in part, because instead of asking "what's the mental model we want to emulate and then never mind if that matches the implementation", they gave developers credit that they can understand a handful of simple concepts and made the actual design and data model as simple as possible. P…
Re: Git koans
#60Earlier quoted context omitted.
Mercurial is essentially git with a clean interface and drastically fewer workflows. If it weren't for github's existence I'd recommend hg to anyone. That said hg is the better choice for big software shops IMO, because of the lower training cost and because they probably won't use github anyway.
> That said hg is the better choice for big software shops IMO, because of the lower training cost and because they probably won't use github anyway. Considering more people know git I would assume the training cost for hg is higher.