This is an attempt at a continuation of an earlier thread:

I would have replied to that thread but I didn't see an option to,
maybe because I'm a new member.

I'm using git to keep track of various scripts and configuration files
in my home directory; this system is in use on more than one machine.
Because of the varying availability of packages etc on the different
machines, some things need to be done a bit differently.  Although it
would be possible to set this up to happen using configuration
variables etc., I'd like to do it by having a different branch of the
'common' branch for each machine.

However it's a bit tricky, because although in general most commits
will be being merged back to the common branch, the working tree needs
to stay on the machine-specific branch, because it's effectively a
production system.  So if we do it the normal way we end up with
something like this drawing, which you may have to cut-and-paste
somewhere to see actually line up:

  machine1    A--B--C
             /       \
  common    A---------C

Here we have the machine1 branch being branched off of common at A.
Commit B is something that's specific to machine1, and shouldn't ever
go to common.
At commit C we want to make a commit directly to common, but we can't.
Then it gets merged back into common with the changes from commit B
included, which is not what we want.

  machine1    A--B----C
             /       /
  common    A-------D

In this version we end up with common's HEAD at D, which is the
changes from C without the changes from B.  machine1 ends up the same
after the merge.

The only problem is that there's not an obvious way to create this
history without cloning the repo or switching branches.   Since there
is likely at any point in time to be a mix of changes destined for
machine1 and common, stashing wouldn't necessarily provide a solution,
and that would still require switching branches.  I'd like to be able
to use the index and just commit the index contents to a different
branch than the one that's checked out.

The earlier thread referenced above mentioned that it would likely be
possible to do something like this using plumbing commands.  I'm
hoping for some direction towards figuring out how to do so.


You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to