PaX Team wrote:this may work only when you check out the exact branch into each working directory (and i'm not sure how commits from one and pulls into another will work in that case), but it will fail with different branches for sure (what's HEAD?)
Actually, it just hit me. The "symbolic-ref" function ought to make this work with different branches. It works like this:
git symbolic-ref HEAD refs/heads/yourbranch
It makes you "switch branches" without touching the working tree at all.
Say you've cloned 2.6.33 and make 2 branches, each to be compiled in the directory of its own:
cd branch1/
..do work..
commit
cd ../branch2/
At this point you see 'git status' as the commit from branch1 in reverse. You then type:
git symbolic-ref HEAD refs/heads/branch2
It's now a clean working tree. You can do different commits and they won't affect branch1. When you commit and head back into branch1, you'll see the commits from branch2 in reverse; simply symbolic-ref the HEAD back to branch1 for a "clean" status. Then if you want to merge, you can pull in changes to the locally checked out branch like you normally would.
The symbolic-ref doesn't actually touch any of the files in the checkout, so re-running the make command after all has been built won't need to recompile anything. I know how much it sucks to have to touch a file like init/main.c and sit and wait for the whole thing to start over.
You could simply alias that symbolic-ref command to make it shorter to type too.
PaX Team wrote:as i said, there're certain hacks that do something like this, look at /usr/share/git/contrib/workdir/git-new-workdir but it's still fragile.
I suppose this is a "hack" as well. But I started trying it and it works for me. Also on the plus side, no more of the messy push/pull between local checkouts to pass changes between each of them, and forgetting to update some of them on occasion, because they all point to the same repo via the .git symlink.
You could then technically track the mainline kernel, the stable kernel, and your own branches all in one git repo. You'll just have a lot of "remotes" to pull in the different lines of development into your branches