Git's petty little irritation for me

July 15, 2013

Perhaps the most common thing for me to do with people's source code is to add my own purely local changes. When the source code is in a source repo, the simplest way of doing this is to just pull a copy of the source repo and then make my own changes on top. Then sooner or later I want to update my local repo by pulling in the latest central changes.

With CVS, SVN, and even Mercurial this more or less just works, however theoretically unclean and evil it is; all three detect that I have uncommitted local changes and attempt to re-apply them on top of the updates. Usually this succeeds and if it doesn't, the convention is to stick glaring markers in the files and leave it to me to fix them up. Git insists on doing the right thing in that at least by default it utterly refuses to try to merge my uncommitted changes with the remote updates it's just fetched.

It turns out that this unusual strictness on git's part is irritatingly inconvenient for me. I definitely don't want to actually commit my changes because that would contaminate what is otherwise a pure upstream repo history with a tangle of back and forth merges (even if I did it on a branch). There is 'git stash', but it has two aspects that I don't like; I have to remember (or be reminded) to do it explicitly and it makes changes to the repo itself (not just the checked-out files). I really like my repos to be exact, unchanged duplicates of the upstream.

(Yes, the changes 'git stash' makes should be harmless and should get fixed up when I do 'git stash clear' or the like. That's two 'shoulds'.)

This is a completely petty irritation (especially given 'git stash') and I fully acknowledge that. But I've never claimed to be entirely rational about this stuff and yes, it irritates me.

Sidebar: When this doesn't work in Mercurial

There is one circumstance when Mercurial will not do this sort of update at all, namely when the main branch in the repo shifts. The Mercurial repo for official Firefox releases hops branches this way when a new major release comes out and as a result I get to save a patch of my changes, overwrite them all by forcing a clean checkout, and then reapply them. Fortunately this is rare.

(Also these days I've found up switching to building my local Firefox from the main development repository, which doesn't branch this way.)

Written on 15 July 2013.
« Why single vendor solutions are a hard sell
Systemd needs sensible, non-truncated output »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Jul 15 00:43:30 2013
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.