committing to a branch that's not checked out

Posted by intuited on Stack Overflow See other posts from Stack Overflow or by intuited
Published on 2010-03-20T00:24:16Z Indexed on 2010/03/20 0:31 UTC
Read the original article Hit count: 259

Filed under:

I'm using git to version my home directories on a couple different machines. I'd like for them to each use separate branches and both pull from a common branch. So most commits should be made to that common branch, unless something specific to that machine is being committed, in which case the commit should go to the checked out, machine-specific branch. Switching branches is clearly not a very good option in this case.

It's mentioned in this post that what I want to do is impossible, but I found that answer to be rather blunt and to perhaps not take into account the possibility of using the plumbing commands. Unfortunately I don't have enough reputation to comment on that thread. I rather suspect that there is some way to do this and am hoping to save myself an hour or few of questing for the answer by just asking you good folk.

So is it possible to commit to a different branch without checking that branch out first? Ideally I'd like to use the index in the same way that git commit normally does.

© Stack Overflow or respective owner

Related posts about git