I don't commit changes in my working repos
I build a number of open source projects from source for various reasons of my own, using clones of the upstream master repos. With some of them, I make changes for my own reasons, often changes I will never be attempting to push upstream. Whenever I make changes this way, I do not commit my changes to the repos. This is the case whether the project uses Git or Mercurial.
The plain and simple truth is that if you're going to perpetually
carry modest changes to an upstream project that changes frequently
(and that you're going to re-pull frequently), not committing your
changes is by far the easiest way to operate. If you have uncommitted
changes, almost all of the time a simple '
git pull' or '
-u' will quietly get you up to date. If this doesn't work you can
stash your changes in various ways, update to the latest version
from a pristine setup, and then re-patch your changes. You spend a
minimum amount of time interacting with the version control system,
the actual checked in state of your repo exactly matches the master
repo, and any time you want to know what you changed you can check
git status' or '
hg diff' or so on. It's also really easy to
temporarily or permanently set aside a particular change or set of
If you commit the changes, well, you have a bunch more work and your repo has now diverged from master. Every time you pull an upstream update, you must either merge or rebase your commits; even if the VCS will do this for you automatically this time, the merges or rebases are still there in repo history. If you do merges, any bisection is probably going to be more exciting. If you do rebases, your repo steadily accumulates a bunch of clutter in the corners. In either case monitoring the state of your changes is somewhat less straightforward, as is manipulating them.
It's my view that all of the stuff you have to do if you commit your changes is essentially make-work. There are cases where it's (potentially) useful, but those cases have been few and far between for me, and in the mean time I'd be doing a lot of VCS commands that I don't currently have to.
(I find the situation unfortunate but as far as I know neither Git nor Mercurial has extensions or features that would improve the situation. Git autorebase is sort of what I want, but not quite. Life is complicated by the fact that upstreams sometimes screw up their repos so that my local mirror repo diverges from their new reality, in which case I want to abandon my repo and just re-clone from upstream (and apply my changes again).)
(I mentioned this yesterday but I suspect it's a sufficiently odd way of working that I wanted to explain it directly.)
Comments on this page:Written on 29 May 2015.