{"thread":{"id":"2260","subject":"Question on GIT usage.","startedAt":"2005-10-29T00:49:04Z","lastAt":"2005-11-01T00:23:56Z","messageCount":9,"participants":["Ben Greear","Ryan Anderson","Linus Torvalds","Daniel Barkalow","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"10770","messageId":"4362C700.6020901@candelatech.com","threadId":"2260","inReplyTo":null,"subject":"Question on GIT usage.","fromName":"Ben Greear","fromEmail":"greearb@candelatech.com","sentAt":"2005-10-29T00:49:04Z","receivedAt":"2005-10-29T00:49:04Z","isPatch":false,"sender":{"key":"greearb@candelatech.com","avatar":null},"body":"\nI have a kernel GIT tree to hold my developing patches...\n\nI need to build this kernel for 4-5 different processors (c3, p2, p4, p4-smp, etc).\n\nIs there any clever way to have this one git repository keep these\nother source trees in sync so that I can do incremental builds?\n\nShould I perhaps have a unique git repo for each different build and\njust pull changes in from my master repo before building?\n\nIf there's a simple command to set up slave repositories like this,\nplease point me to it.\n\nThanks!\nBen\n\n-- \nBen Greear <greearb@candelatech.com>\nCandela Technologies Inc  http://www.candelatech.com\n"},{"id":"10771","messageId":"4362D3BB.3050601@michonline.com","threadId":"2260","inReplyTo":"4362C700.6020901@candelatech.com","subject":"Re: Question on GIT usage.","fromName":"Ryan Anderson","fromEmail":"ryan@michonline.com","sentAt":"2005-10-29T01:43:23Z","receivedAt":"2005-10-29T01:43:23Z","isPatch":false,"sender":{"key":"ryan@michonline.com","avatar":null},"body":"Ben Greear wrote:\n> \n> I have a kernel GIT tree to hold my developing patches...\n> \n> I need to build this kernel for 4-5 different processors (c3, p2, p4,\n> p4-smp, etc).\n> \n> Is there any clever way to have this one git repository keep these\n> other source trees in sync so that I can do incremental builds?\n> \n> Should I perhaps have a unique git repo for each different build and\n> just pull changes in from my master repo before building?\n> \n> If there's a simple command to set up slave repositories like this,\n> please point me to it.\n\nThere isn't, not really - but in the kernel's case, you don't need one,\neither.\n\nBuild with:\n\tmake O=/path/to/c3/tree\n\nPut your .config in /path/to/c3/tree/\n\nAll your compiled stuff will drop into that tree, and your source tree\nwill stay untouched, so you can have a single GIT tree and source files.\n\n"},{"id":"10772","messageId":"Pine.LNX.4.64.0510281847220.3348@g5.osdl.org","threadId":"2260","inReplyTo":"4362C700.6020901@candelatech.com","subject":"Re: Question on GIT usage.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-29T02:06:22Z","receivedAt":"2005-10-29T02:06:22Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 28 Oct 2005, Ben Greear wrote:\n> \n> I have a kernel GIT tree to hold my developing patches...\n> \n> I need to build this kernel for 4-5 different processors (c3, p2, p4, p4-smp,\n> etc).\n\nSounds like you just want to use a separate build directory for the \nkernel, which you can do quite independently of git (of course, not too \nmany people use it, so the separate-object-directory Kbuild infrastructure \nhas bugs every once in a while..)\n\nThe way it _should_ work is that you can do something like this:\n\n\t.. have a clean source-tree in ~/src/linux ..\n\n\t# set up the build tree\n\tcd\n\tmkdir build-tree\n\tcd ~/src/linux\n\tmake O=~/build-tree oldconfig\n\n\t# go there and build it\n\tcd ~/build-tree\n\tmake\n\nand now you can have a build-tree for each of your different \narchitectures.\n\nNow, you _can_ certainly do the very same thing with just multiple git \nrepositories, and pull between them. That has its own set of advantages \ntoo: you can have slight differences between the trees. Of course, if you \nknow you don't want any differences between the trees, that's not an \nadvantage, that's a disadvantage.\n\nYou can also have just one single real git repository, and then have that \none checked out multiple times. Use GIT_OBJECT_DIRECTORY to share the core \nobjects, and then you can have ten different git trees without duplicating \nall your objects and pack-files.\n\n> Is there any clever way to have this one git repository keep these\n> other source trees in sync so that I can do incremental builds?\n\nIf you really want them 100%, the separate build trees is the best option.\n\nThat said, a lot of _other_ projects don't do separate build trees that \nwell (and as mentioned, sometimes it breaks for the kernel too), and git \ncertainly could be set up to be a \"poor mans separate build tree\".\n\nRight now the easiest way to do that is to just have separate repositories \n(and share at least _some_ objects by just using \"git clone -l -s\" to \nclone them), but it could be hacked to be more geared explicitly towards \nthat..\n\n\t\tLinus\n"},{"id":"10888","messageId":"Pine.LNX.4.64.0510311749080.25300@iabervon.org","threadId":"2260","inReplyTo":"4362C700.6020901@candelatech.com","subject":"Re: Question on GIT usage.","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-10-31T23:03:08Z","receivedAt":"2005-10-31T23:03:08Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Fri, 28 Oct 2005, Ben Greear wrote:\n\n> I have a kernel GIT tree to hold my developing patches...\n> \n> I need to build this kernel for 4-5 different processors (c3, p2, p4, p4-smp,\n> etc).\n> \n> Is there any clever way to have this one git repository keep these\n> other source trees in sync so that I can do incremental builds?\n\nThe following is not at all standard; AFAICT, I'm the only person who does \nit. But...\n\nYou can have a single repository shared between multiple working trees, by \nhaving the repository somewhere and making \n.git/{objects,refs,info,remotes} be symlinks to the corresponding \ndirectories in the repository. I've got a script to set this up, if you \nwant.\n\nThe system will be unhappy if you commit to a branch that is checked out \nelsewhere (because the head of that branch will change out from under the \nchecked out version), like having someone push to a repository with the \nbranch checked out.\n\nYou need to think about this as there only being one repository that has \nmultiple working trees, rather than having working tree/repository pairs, \nwhere the repositories are connected as an optimization; anything you do \nin one of the working trees will automatically affect what the others see.\n\nThis isn't official supported, but it actually works quite well, except \nthat things that should be shared are occasionally added to the .git \ndirectory (like remotes not too long ago).\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"10889","messageId":"Pine.LNX.4.64.0510311520190.27915@g5.osdl.org","threadId":"2260","inReplyTo":"Pine.LNX.4.64.0510311749080.25300@iabervon.org","subject":"Re: Question on GIT usage.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-31T23:21:11Z","receivedAt":"2005-10-31T23:21:11Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 31 Oct 2005, Daniel Barkalow wrote:\n> \n> The system will be unhappy if you commit to a branch that is checked out \n> elsewhere (because the head of that branch will change out from under the \n> checked out version), like having someone push to a repository with the \n> branch checked out.\n\nWell, the good news is that a \"git checkout -f\" in the other trees will do \nthe right thing (and only check out the files that have changed).\n\nThe bad news is that you need to remember to do that ;)\n\n\t\tLinus\n"},{"id":"10891","messageId":"Pine.LNX.4.64.0510311821410.25300@iabervon.org","threadId":"2260","inReplyTo":"Pine.LNX.4.64.0510311520190.27915@g5.osdl.org","subject":"Re: Question on GIT usage.","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-10-31T23:37:48Z","receivedAt":"2005-10-31T23:37:48Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 31 Oct 2005, Linus Torvalds wrote:\n\n> On Mon, 31 Oct 2005, Daniel Barkalow wrote:\n> > \n> > The system will be unhappy if you commit to a branch that is checked out \n> > elsewhere (because the head of that branch will change out from under the \n> > checked out version), like having someone push to a repository with the \n> > branch checked out.\n> \n> Well, the good news is that a \"git checkout -f\" in the other trees will do \n> the right thing (and only check out the files that have changed).\n> \n> The bad news is that you need to remember to do that ;)\n\nIf we wanted to make this work reliably, we could have a \n\"LAST_CHECKED_OUT\" which has an actual hash (rather than being a link like \nHEAD is), and gets set by the checkout. Then it would always know what \ncommit you have checked out, even if something causes HEAD to not match.\n\nI personally just never have the same branch checked out twice, so the \nsituation doesn't happen to me. It's easy enough to add additional \nbranches.\n\nOh, that reminds me: is there a simple way to merge a branch with another \nlocal branch or remote branch that's already up-to-date? E.g., I've \nalready fetched the latest git from kernel.org, built it, and installed \nit. Now I want to merge my development branch with that. Last time I was \nlooking, I had to write the message for the merge myself, unlike \"pull\", \nwhich takes care of that.\n\nAlso, I have a repository on my server for one of my projects. I push from \nmy workstation to the \"mainline\" branch, and I have \"deploy\" checked out \n(with some configuration changes that shouldn't propagate back). Then I \nmerge \"mainline\" into \"deploy\", build, and install. Same thing; I have to \nwrite the \"merge with mainline\" argument myself.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"10892","messageId":"Pine.LNX.4.64.0510311540300.27915@g5.osdl.org","threadId":"2260","inReplyTo":"Pine.LNX.4.64.0510311821410.25300@iabervon.org","subject":"Re: Question on GIT usage.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-31T23:42:33Z","receivedAt":"2005-10-31T23:42:33Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 31 Oct 2005, Daniel Barkalow wrote:\n> \n> Oh, that reminds me: is there a simple way to merge a branch with another \n> local branch or remote branch that's already up-to-date? E.g., I've \n> already fetched the latest git from kernel.org, built it, and installed \n> it. Now I want to merge my development branch with that. Last time I was \n> looking, I had to write the message for the merge myself, unlike \"pull\", \n> which takes care of that.\n\nUmm.. Why don't you just use \"pull\"?\n\nI _think_ you should be able to just do\n\n\tgit pull <repodir> <branchname>\n\nwhere <repodir> can even be just \".\" for the very same repository.\n\nI've not tested it, but dammit, it should work. If it doesn't, it's a bug.\n\n\t\tLinus\n"},{"id":"10895","messageId":"Pine.LNX.4.64.0510311847570.25300@iabervon.org","threadId":"2260","inReplyTo":"Pine.LNX.4.64.0510311540300.27915@g5.osdl.org","subject":"Re: Question on GIT usage.","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-10-31T23:56:43Z","receivedAt":"2005-10-31T23:56:43Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 31 Oct 2005, Linus Torvalds wrote:\n\n> On Mon, 31 Oct 2005, Daniel Barkalow wrote:\n> > \n> > Oh, that reminds me: is there a simple way to merge a branch with another \n> > local branch or remote branch that's already up-to-date? E.g., I've \n> > already fetched the latest git from kernel.org, built it, and installed \n> > it. Now I want to merge my development branch with that. Last time I was \n> > looking, I had to write the message for the merge myself, unlike \"pull\", \n> > which takes care of that.\n> \n> Umm.. Why don't you just use \"pull\"?\n> \n> I _think_ you should be able to just do\n> \n> \tgit pull <repodir> <branchname>\n> \n> where <repodir> can even be just \".\" for the very same repository.\n> \n> I've not tested it, but dammit, it should work. If it doesn't, it's a bug.\n\nThat does follow logically, but it really ought to be an example in the \ndocumentation, because \"fetch what you have from yourself and merge it\" \nisn't the first thing that comes to mind for me. :)\n\nI'll make sure that works and comes out nicely, and then send in a \nDocumentation patch.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"10899","messageId":"7v7jbtb4gz.fsf@assigned-by-dhcp.cox.net","threadId":"2260","inReplyTo":"Pine.LNX.4.64.0510311540300.27915@g5.osdl.org","subject":"Re: Question on GIT usage.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-01T00:23:56Z","receivedAt":"2005-11-01T00:23:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> I _think_ you should be able to just do\n>\n> \tgit pull <repodir> <branchname>\n>\n> where <repodir> can even be just \".\" for the very same repository.\n>\n> I've not tested it, but dammit, it should work. If it doesn't, it's a bug.\n\nI know it works.  'git pull . somebranch' is the command I use\nthe second most often in the git suite (the first being\ngit-show-branch).\n"}]}