{"thread":{"id":"31483","subject":"Keeping two repos in sync","startedAt":"2012-09-09T08:12:32Z","lastAt":"2012-09-09T09:03:09Z","messageCount":4,"participants":["David Chanters","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"198617","messageId":"CACffvTqt9UHw1wLVDZ=PDqJuktcD8M7uUfnnuDZ5cf9gwxsSqA@mail.gmail.com","threadId":"31483","inReplyTo":null,"subject":"Keeping two repos in sync","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2012-09-09T08:12:32Z","receivedAt":"2012-09-09T08:12:32Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"Hi all,\n\nI'm wondering how best to go about this problem.  I've got two\nseparate git repositories -- one is a portable version which I'll call\n\"portable\", the other is part of a BSD project, which I'll call \"bsd\".\n Both repositories have the same set of *conceptual* files in them,\nit's just that the portable repository has additional files which are\nnot found in the bsd repository.  It should be noted that the bsd\nrepository is an automatically managed cvsexport clone of a CVS\nrepository -- but I don't think this matters here, as we're just\ntalking about two git repositories.\n\nThe \"workflow\" if you can call it that, is commits happen in the bsd\nrepository and are then put in the portable repo.  At the moment, I am\nusing git grafts to do this.  The important point to remember here is\nthe two repositories DO NOT have any common history to them -- it's\njust that where the files are the same in both the bsd and portable\nrepository I can see and hence tell git, where to graft the two master\nbranches from each repository and for me to merge bsd:master ->\nportable:master.\n\nHowever, I am wondering how best to handle this situation.  It's\npretty convoluted -- not to mention the fact that git grafts are never\npermanent.  What I'd like is for some \"safe\" way of setting up an\ninitial git graft which tied the two master branches between bsd and\nportable to reflect changes on bsd:master not on portable:master and\nthen for me to treat those two branches as though they shared common\nhistory so that I can merge one to the other.  Unfortunately, what I'm\ndoing at the moment is each time changes happen to bsd:master, I'm\nhaving to reset the git graft each time; and since that operation is a\nlocal one, it makes things rather awkward in a shared repository\nsituation as I am the sole person who can perform these merges.\n\nI'm guessing I could rebase at some point and push those changes out?\nI'm just wondering how other people handle this situation or if it's\njust unique to me?\n\nKindly,\n\nDavid\n"},{"id":"198618","messageId":"m2k3w3lhjc.fsf@igel.home","threadId":"31483","inReplyTo":"CACffvTqt9UHw1wLVDZ=PDqJuktcD8M7uUfnnuDZ5cf9gwxsSqA@mail.gmail.com","subject":"Re: Keeping two repos in sync","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-09-09T08:36:07Z","receivedAt":"2012-09-09T08:36:07Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Add \"bsd\" as a remote in \"portable\" and cherry-pick each commit in\n\"bsd\".\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"198619","messageId":"CACffvTryOcefmqNdJ00TuDPov+TpRZRvZ46UDV-8F_cdp80SgA@mail.gmail.com","threadId":"31483","inReplyTo":"m2k3w3lhjc.fsf@igel.home","subject":"Re: Keeping two repos in sync","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2012-09-09T08:44:05Z","receivedAt":"2012-09-09T08:44:05Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"Hi,\n\nOn 9 September 2012 09:36, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Add \"bsd\" as a remote in \"portable\" and cherry-pick each commit in\n> \"bsd\".\n\nI am already kind of doing this at the moment.  Hence:\n\n1.  In portable, I have:\n\n% git remote add bsd /path/to/bsd/repo\n% git fetch bsd\n\n2.  At this point I scan the two branches looking for a point to\ngraft; I might have done this already in the past, but the point is\nsince grafting is a local operation and I am not working in that\nrepository, I might need to do it again anyway -- that graft\nrepresents a way of tieing the branches together at a point I can then\n\"git merge\".\n\nKindly,\n\nDavid\n"},{"id":"198620","messageId":"m2fw6rlgaa.fsf@igel.home","threadId":"31483","inReplyTo":"CACffvTryOcefmqNdJ00TuDPov+TpRZRvZ46UDV-8F_cdp80SgA@mail.gmail.com","subject":"Re: Keeping two repos in sync","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-09-09T09:03:09Z","receivedAt":"2012-09-09T09:03:09Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"David Chanters <david.chanters@googlemail.com> writes:\n\n> 2.  At this point I scan the two branches looking for a point to\n> graft; I might have done this already in the past, but the point is\n> since grafting is a local operation and I am not working in that\n> repository, I might need to do it again anyway -- that graft\n> represents a way of tieing the branches together at a point I can then\n> \"git merge\".\n\nYou can \"git merge -s ours\" that grafting point, assuming \"portable\"\ncompletely subsumes \"bsd\" at that point.  Future merges should then be\nworking normally.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}