{"thread":{"id":"43487","subject":"Re: Question on multi-level git repository heiarchy.","startedAt":"2006-10-27T05:12:09Z","lastAt":"2006-11-16T00:43:04Z","messageCount":5,"participants":["Andy Parkins","Ben Greear","Shawn Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"295197","messageId":"45419529.3010207@candelatech.com","threadId":"43487","inReplyTo":null,"subject":"Question on multi-level git repository heiarchy.","fromName":"Ben Greear","fromEmail":"greearb@candelatech.com","sentAt":"2006-10-27T05:12:09Z","receivedAt":"2006-10-27T05:12:09Z","isPatch":false,"sender":{"key":"greearb@candelatech.com","avatar":null},"body":"Some time back, I cloned from the official kernel site.  I have created \nseveral\nbranches and patches and such, recently branching off of 2.6.18\n\nI want to create an intermediate level..something like:\n\nkernel.org git tree\n       |\nmy git master tree\n /                          \\\nwork-station-1   work-station-2  ....\n\n\nEach of the work-station repositories should push/pull from my git \nmaster tree, and occasionally\nthe git master tree will also pull from the kernel.org git tree.\n\nTo attempt this, I uploaded the .git tree from my local work \nstation..the tree I cloned a while\nback, to the public server.\n\nI was then able to clone the public server git tree on my local \nwork-station in a clean directory.\n\nSo far so good...\n\nBoth pub server and work station had the current branch set to \nlf_v2.6.18, and gitk showed\nthe head and latest patch as what I would expect.  I then did a git \ncheckout -f master on the\npub server and did a pull from the upstream kernel.\nThis seemed to work fine.\n\nThen, on the work-station, I did a git checkout -f master, and also did \na pull.\nIn this case, it seems that it is trying to merge with changes in the \nlf_v2.6.18 branch\ninstead of the the main 'master' tree (see below).\n\nSo, am I going about this all wrong, or did I just run into a glitch of \nsome sort?  I should\nmention that the work-station below is running git 1.3, where the master \nis running git 1.4.2.4 (latest in FC4).\n\n[greear@xeon-dt linux-2.6.dev]$ git checkout -f master\n[greear@xeon-dt linux-2.6.dev]$ git pull\ngreearb@ns2.lanforge.com's password:\nGenerating pack...\nDone counting 1553 objects.\nResult has 1056 objects.\nDeltifying 1056 objects.\n 100% (1056/1056) done\nUnpacking 1056 objects\nTotal 1056, written 1056 (delta 894), reused 0 (delta 0)\n 100% (1056/1056) done\n* refs/heads/master: fast forward to branch 'master' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n  from 04fed361dadb7921507a470947ac23d2f26352cf to \ne80391500078b524083ba51c3df01bbaaecc94bb\n* refs/heads/lf_v2.6.17.x: same as branch 'lf_v2.6.17.x' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/lk_v2.6.16.x.sts: same as branch 'lk_v2.6.16.x.sts' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/lf_v2.6.17: same as branch 'lf_v2.6.17' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/lf_v2.6.16.x: same as branch 'lf_v2.6.16.x' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/lk_v2.6.15.x.sts: same as branch 'lk_v2.6.15.x.sts' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/lk_v2.6.17.x: same as branch 'lk_v2.6.17.x' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/lf_v2.6.16: same as branch 'lf_v2.6.16' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/origin: same as branch 'lf_v2.6.18' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\n* refs/heads/lk_v2.6.16.x: same as branch 'lk_v2.6.16.x' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\ngreearb@ns2.lanforge.com's password:\nAuto-following refs/tags/v2.6.19-rc3\ngreearb@ns2.lanforge.com's password:\nGenerating pack...\nDone counting 1 objects.\nDeltifying 1 objects.\n 100% (1/1) done\nTotal 1, written 1 (delta 0), reused 0 (delta 0)\nUnpacking 1 objects\n 100% (1/1) done\n* refs/tags/v2.6.19-rc3: storing tag 'v2.6.19-rc3' of \ngreearb@ns2.lanforge.com:/pub/linux-2.6\nWarning: fetch updated the current branch head.\nWarning: fast forwarding your working tree from\nWarning: 04fed361dadb7921507a470947ac23d2f26352cf commit.\nTrying really trivial in-index merge...\nfatal: Merge requires file-level merging\nNope.\nMerging HEAD with ea50583c9fba2e289d434bda9798a7b77ee8e3b4\nMerging:\ne80391500078b524083ba51c3df01bbaaecc94bb Merge \nmaster.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6\nea50583c9fba2e289d434bda9798a7b77ee8e3b4 Initial work of merging pktgen \nchanges into 2.6.18.\nfound 1 common ancestor(s):\ne478bec0ba0a83a48a0f6982934b6de079e7e6b3 Linux v2.6.18. Arrr!\nAuto-merging net/core/skbuff.c\nAuto-merging include/net/sock.h\nAuto-merging net/core/pktgen.c\nCONFLICT (content): Merge conflict in net/core/pktgen.c\nAuto-merging net/decnet/dn_table.c\nCONFLICT (content): Merge conflict in net/decnet/dn_table.c\nAuto-merging net/ipv4/fib_frontend.c\nCONFLICT (content): Merge conflict in net/ipv4/fib_frontend.c\nAuto-merging arch/i386/kernel/tsc.c\nAuto-merging net/ipv4/fib_rules.c\nCONFLICT (content): Merge conflict in net/ipv4/fib_rules.c\nAuto-merging net/core/dev.c\nAuto-merging drivers/net/e1000/e1000_main.c\nCONFLICT (content): Merge conflict in drivers/net/e1000/e1000_main.c\nAuto-merging net/ipv4/arp.c\nCONFLICT (content): Merge conflict in net/ipv4/arp.c\nAuto-merging net/decnet/dn_fib.c\nCONFLICT (content): Merge conflict in net/decnet/dn_fib.c\nAuto-merging net/socket.c\nAuto-merging include/linux/if.h\nAuto-merging include/linux/compat_ioctl.h\nAuto-merging include/linux/skbuff.h\nAuto-merging include/linux/rtnetlink.h\nCONFLICT (content): Merge conflict in include/linux/rtnetlink.h\nAuto-merging fs/cifs/cifsglob.h\nAuto-merging include/linux/if_vlan.h\nAuto-merging net/ipv4/route.c\nCONFLICT (content): Merge conflict in net/ipv4/route.c\nAuto-merging net/core/ethtool.c\nCONFLICT (content): Merge conflict in net/core/ethtool.c\nAuto-merging net/packet/af_packet.c\nAuto-merging include/linux/nfs_fs_sb.h\nCONFLICT (content): Merge conflict in include/linux/nfs_fs_sb.h\nAuto-merging net/8021q/vlan_dev.c\nAuto-merging net/ipv6/route.c\nCONFLICT (content): Merge conflict in net/ipv6/route.c\nAuto-merging net/ipv4/fib_trie.c\nAuto-merging include/linux/sunrpc/xprt.h\nAuto-merging include/net/neighbour.h\nAuto-merging include/net/ip_fib.h\nCONFLICT (content): Merge conflict in include/net/ip_fib.h\nAuto-merging drivers/net/e100.c\nAuto-merging drivers/net/e1000/e1000.h\nCONFLICT (content): Merge conflict in drivers/net/e1000/e1000.h\nAuto-merging net/ipv4/fib_semantics.c\nCONFLICT (content): Merge conflict in net/ipv4/fib_semantics.c\nAuto-merging drivers/pci/quirks.c\nAuto-merging net/ipv4/fib_lookup.h\nCONFLICT (content): Merge conflict in net/ipv4/fib_lookup.h\nAuto-merging net/ipv4/fib_hash.c\nAuto-merging net/core/sock.c\nAuto-merging net/Makefile\nCONFLICT (content): Merge conflict in net/Makefile\nAuto-merging net/decnet/dn_rules.c\nCONFLICT (content): Merge conflict in net/decnet/dn_rules.c\nAuto-merging include/linux/netdevice.h\nAuto-merging net/decnet/dn_route.c\nAuto-merging net/sunrpc/xprtsock.c\nAuto-merging net/Kconfig\nAuto-merging drivers/net/e1000/e1000_ethtool.c\nCONFLICT (content): Merge conflict in drivers/net/e1000/e1000_ethtool.c\nAuto-merging include/net/dn_fib.h\nCONFLICT (content): Merge conflict in include/net/dn_fib.h\nAuto-merging fs/nfs/super.c\nCONFLICT (content): Merge conflict in fs/nfs/super.c\nAuto-merging fs/cifs/connect.c\nCONFLICT (content): Merge conflict in fs/cifs/connect.c\n\nAutomatic merge failed; fix conflicts and then commit the result.\n[greear@xeon-dt linux-2.6.dev]$ git branch\n  lf_v2.6.16\n  lf_v2.6.16.x\n  lf_v2.6.17\n  lf_v2.6.17.x\n  lf_v2.6.18\n  lk_v2.6.15.x.sts\n  lk_v2.6.16.x\n  lk_v2.6.16.x.sts\n  lk_v2.6.17.x\n* master\n  origin\n[greear@xeon-dt linux-2.6.dev]$ gitk\n\n-- \nBen Greear <greearb@candelatech.com> \nCandela Technologies Inc  http://www.candelatech.com\n\n"},{"id":"295515","messageId":"20061027052517.GB29057@spearce.org","threadId":"43487","inReplyTo":"45419529.3010207@candelatech.com","subject":"Re: Question on multi-level git repository heiarchy.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-10-27T05:25:17Z","receivedAt":"2006-10-27T05:25:17Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Ben Greear <greearb@candelatech.com> wrote:\n> I want to create an intermediate level..something like:\n> \n> kernel.org git tree\n>       |\n> my git master tree\n> /                          \\\n> work-station-1   work-station-2  ....\n \n> I then did a git  checkout -f master on the\n> pub server and did a pull from the upstream kernel.\n> This seemed to work fine.\n\nAh, what you really want here is to make your \"my git master tree\"\na bare repostiory and use fetch instead of pull.  This way you\ndon't need to maintain a working directory of files associated\nwith that repository.  So assuming you have \"mygitmastertree\"\nas the directory do:\n\n\tmv mygitmastertree/.git mygitmastertree.git\n\trm -rf mygitmastertree\n\nand update your workstation .git/remotes/origin files such\nthat the URL line reads \".../mygitmastertree.git\" rather than\n\".../mygitmastertree/.git\".\n\nThen to update \"mygitmastertree\" with recent changes you can use\ngit fetch rather than git pull:\n\n\tgit --git-dir mygitmastertree.git fetch\n \n> Then, on the work-station, I did a git checkout -f master, and also did \n> a pull.\n> In this case, it seems that it is trying to merge with changes in the \n> lf_v2.6.18 branch\n> instead of the the main 'master' tree (see below).\n\nWhen you use \"git pull\" with no additional arguments the first\nbranch listed in a Pull: line of .git/remotes/origin will be the\nbranch merged into the current branch.  I don't know what that\nbranch is listed as in your workstation tree but from what you\ndescribed it sounds like it may be that lf_v2.6.18 branch, which\nis why its trying to merge it.\n\n-- \n"},{"id":"297958","messageId":"4542120E.1050903@candelatech.com","threadId":"43487","inReplyTo":"20061027052517.GB29057@spearce.org","subject":"Re: Question on multi-level git repository heiarchy.","fromName":"Ben Greear","fromEmail":"greearb@candelatech.com","sentAt":"2006-10-27T14:05:02Z","receivedAt":"2006-10-27T14:05:02Z","isPatch":false,"sender":{"key":"greearb@candelatech.com","avatar":null},"body":"Shawn Pearce wrote:\n> Ben Greear <greearb@candelatech.com> wrote:\n>   \n>> I want to create an intermediate level..something like:\n>>\n>> kernel.org git tree\n>>       |\n>> my git master tree\n>> /                          \\\n>> work-station-1   work-station-2  ....\n>>     \n>  \n>   \n>> I then did a git  checkout -f master on the\n>> pub server and did a pull from the upstream kernel.\n>> This seemed to work fine.\n>>     \n>\n> Ah, what you really want here is to make your \"my git master tree\"\n> a bare repostiory and use fetch instead of pull.  This way you\n> don't need to maintain a working directory of files associated\n> with that repository.  So assuming you have \"mygitmastertree\"\n> as the directory do:\n>\n> \tmv mygitmastertree/.git mygitmastertree.git\n> \trm -rf mygitmastertree\n>\n> and update your workstation .git/remotes/origin files such\n> that the URL line reads \".../mygitmastertree.git\" rather than\n> \".../mygitmastertree/.git\".\n>\n> Then to update \"mygitmastertree\" with recent changes you can use\n> git fetch rather than git pull:\n>\n> \tgit --git-dir mygitmastertree.git fetch\n>   \n\nOk, I made those changes...\n>  \n>   \n>> Then, on the work-station, I did a git checkout -f master, and also did \n>> a pull.\n>> In this case, it seems that it is trying to merge with changes in the \n>> lf_v2.6.18 branch\n>> instead of the the main 'master' tree (see below).\n>>     \n>\n> When you use \"git pull\" with no additional arguments the first\n> branch listed in a Pull: line of .git/remotes/origin will be the\n> branch merged into the current branch.  I don't know what that\n> branch is listed as in your workstation tree but from what you\n> described it sounds like it may be that lf_v2.6.18 branch, which\n> is why its trying to merge it.\n>   \nThat is certainly not intuitive.\n\nI want to synchronize the entire git repo, including all branches.  How \nwould I go\nabout doing that?\n\nIs there any way to recover my currently mangled tree on the \nworkstation, or do I need\nto start fresh there?  If I start fresh, do I re-clone, or is there some \nbetter way to get\nthe synchronization that I want?\n\nThanks,\nBen\n\n\n\n-- \nBen Greear <greearb@candelatech.com> \nCandela Technologies Inc  http://www.candelatech.com\n\n"},{"id":"295077","messageId":"200610271631.49803.andyparkins@gmail.com","threadId":"43487","inReplyTo":"4542120E.1050903@candelatech.com","subject":"Re: Question on multi-level git repository heiarchy.","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-10-27T15:31:47Z","receivedAt":"2006-10-27T15:31:47Z","isPatch":false,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2006 October 27 15:05, Ben Greear wrote:\n\n> I want to synchronize the entire git repo, including all branches.  How\n> would I go\n> about doing that?\n\nThat happens anyway.  \"git pull\" is actually a fetch + a merge.  Personally I \nrecommend never doing a \"git pull\" without arguments.  Instead:\n\nFirst, update every \"Pull:\" line from .git/remotes/origin\n $ git fetch\nNow manually merge one of the (now locally stored) upstream trees into your \nworking tree.\n $ git pull . upstream-tree\n\n> Is there any way to recover my currently mangled tree on the\n> workstation, or do I need\n> to start fresh there?  If I start fresh, do I re-clone, or is there some\n> better way to get\n\nI'm relatively new to git; my experience is that there is very little that \ncan't be undone.  Exactly what sort of mangling has happened to your tree?\n\nIf you've got yourself in a real state, I suggest editing .git/remotes/origin \nto pull the upstream trees to some newly named branches (maybe just \nadd \"new/\" to the front of them).  Treat those as read-only (i.e. don't check \nthem out), and start comparing branches.  \"gitk --all\" is incredibly useful \nfor this.\n\nMake yourself a new branch for your own work based off a new/upstream branch  \n(git checkout -b fixthings new/upstream), then use git-cherry-pick to pull \nyour patches out of your mangled tree to build up a branch with your changes \non it.\n\nNow, you can delete all the branches that you think are mangled and (if you \nreally want to), rename all the new/ refs back to whatever they started as.\n\n> the synchronization that I want?\n\nI am going to guess that you've fallen for the same thing I did at first: \nconfusing \"git pull\" with \"git fetch\"; \"git pull\" can get you in \ntrouble, \"git fetch\" probably won't.\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIEE\n"},{"id":"295200","messageId":"455BB418.80402@candelatech.com","threadId":"43487","inReplyTo":"20061027052517.GB29057@spearce.org","subject":"Re: Question on multi-level git repository heiarchy.","fromName":"Ben Greear","fromEmail":"greearb@candelatech.com","sentAt":"2006-11-16T00:43:04Z","receivedAt":"2006-11-16T00:43:04Z","isPatch":false,"sender":{"key":"greearb@candelatech.com","avatar":null},"body":"Shawn Pearce wrote:\n> Ben Greear <greearb@candelatech.com> wrote:\n>> I want to create an intermediate level..something like:\n>>\n>> kernel.org git tree\n>>       |\n>> my git master tree\n>> /                          \\\n>> work-station-1   work-station-2  ....\n>  \n>> I then did a git  checkout -f master on the\n>> pub server and did a pull from the upstream kernel.\n>> This seemed to work fine.\n> \n> Ah, what you really want here is to make your \"my git master tree\"\n> a bare repostiory and use fetch instead of pull.  This way you\n> don't need to maintain a working directory of files associated\n> with that repository.  So assuming you have \"mygitmastertree\"\n> as the directory do:\n> \n> \tmv mygitmastertree/.git mygitmastertree.git\n> \trm -rf mygitmastertree\n> \n> and update your workstation .git/remotes/origin files such\n> that the URL line reads \".../mygitmastertree.git\" rather than\n> \".../mygitmastertree/.git\".\n> \n> Then to update \"mygitmastertree\" with recent changes you can use\n> git fetch rather than git pull:\n> \n> \tgit --git-dir mygitmastertree.git fetch\n>  \n>> Then, on the work-station, I did a git checkout -f master, and also did \n>> a pull.\n>> In this case, it seems that it is trying to merge with changes in the \n>> lf_v2.6.18 branch\n>> instead of the the main 'master' tree (see below).\n> \n> When you use \"git pull\" with no additional arguments the first\n> branch listed in a Pull: line of .git/remotes/origin will be the\n> branch merged into the current branch.  I don't know what that\n> branch is listed as in your workstation tree but from what you\n> described it sounds like it may be that lf_v2.6.18 branch, which\n> is why its trying to merge it.\n\nI have been using a variation of this with some success.  (I didn't rename the .git directory\non the master tree, but the directory only contains a .git directory so I assume that\nI'm using a bare tree....)\n\nI have been able to do 'git pull origin' and 'git push origin master' to\nsync and commit my lf_v2.6.18 branch from my work-station repositories (per this page's instructions:\nhttp://www.kernel.org/pub/software/scm/git/docs/cvs-migration.html\n\nNow, I would like to fetch down all of the changes from kernel.org to my master\ntree and then update my work-station branches.  On the master,\nI ran 'git fetch'.  It took a while and seemed to do the right thing.\nThere is still nothing other than .git in the directory, and subsequent\n'git fetch' calls return quickly w/out doing anything.\n\nHowever, I cannot find an incantation on the work-station machines to\npull down the changes and sync up with kernel.org.\n\nI did a 'git fetch' on the work-station, but gitk still does not show anything\nnew in 'master' or 'lf_v2.6.18\n\nI tried checking out master and running:  git pull . master\nbut it said Already up-to-date.\n\nI tried checking out the master branch on the work-station and doing a 'git pull' there.\nIt got a lot of conflicts from the changes that I had made in the lf_v2.6.18 branch.\n\nI want to have some local branch contain only official kernel patches, and\nthen fork my own branches off to track my individual changes.  My assumption\nwas that I could do something like:\n\ngit checkout master\ngit pull\n\nand have master updated with (only) the latest tree from kernel.org and have\nlf_v2.6.18 un-touched.\n\nAny pointers are welcome.\n\nThanks,\nBen\n\n-- \nBen Greear <greearb@candelatech.com>\nCandela Technologies Inc  http://www.candelatech.com\n"}]}