{"thread":{"id":"21178","subject":"Merging non-git releases of a project","startedAt":"2009-10-09T21:11:19Z","lastAt":"2009-10-11T15:32:23Z","messageCount":9,"participants":["Howard Miller","Avery Pennarun","Peter Baumann","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"124529","messageId":"26ae428a0910091411i39a03650o51163f794b984524@mail.gmail.com","threadId":"21178","inReplyTo":null,"subject":"Merging non-git releases of a project","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-09T21:11:19Z","receivedAt":"2009-10-09T21:11:19Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"Here's my dilemma.... I've used git extensively to track modifications\nmade to a reasonably large source tree. I do not have access to the\nrepository for that project, just a given release. I have now acquired\nthe latest version of that project and I want to 'merge' (not sure\nthat's the right word in this case) my changes into the new version.\nThen I need to carry on using git for further changes. I think it\nshould be simple but I can't get my head around the best way to do\nthis.\n\nAny pointers appreciated!\n"},{"id":"124530","messageId":"32541b130910091427i7c8a2426hb69a9914aabde8bc@mail.gmail.com","threadId":"21178","inReplyTo":"26ae428a0910091411i39a03650o51163f794b984524@mail.gmail.com","subject":"Re: Merging non-git releases of a project","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-10-09T21:27:23Z","receivedAt":"2009-10-09T21:27:23Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Fri, Oct 9, 2009 at 5:11 PM, Howard Miller\n<howard@e-learndesign.co.uk> wrote:\n> Here's my dilemma.... I've used git extensively to track modifications\n> made to a reasonably large source tree. I do not have access to the\n> repository for that project, just a given release. I have now acquired\n> the latest version of that project and I want to 'merge' (not sure\n> that's the right word in this case) my changes into the new version.\n> Then I need to carry on using git for further changes. I think it\n> should be simple but I can't get my head around the best way to do\n> this.\n\nFind out the commitid of the first commit when you checked in the\nupstream project into git, and call it C1.\n\n  git checkout -b vendor C1\n\n(replacing C1 with the commitid).  This creates a branch called\n'vendor' which is for checking in *only* the pristine code provided by\nthe vendor.  It also checks out this new branch.\n\nNext, import the new upstream version of the project and commit it to\nthe 'vendor' branch.\n\nNow, switch back to your branch and merge in the vendor changes:\n\n  git checkout master\n  git merge vendor\n\nOr, if you want to produce a clean set of patches on top of the vendor\nversion (ie. for submitting the individual patches upstream), you\nmight want something like this instead:\n\n  git rebase vendor\n\nBut be careful, rebasing can make a mess of your history and you\nshouldn't do it unless you have a good reason.\n\nGood luck.\n\nAvery\n"},{"id":"124532","messageId":"26ae428a0910091433v2c959a70g9bfc6c54382f370d@mail.gmail.com","threadId":"21178","inReplyTo":"32541b130910091427i7c8a2426hb69a9914aabde8bc@mail.gmail.com","subject":"Re: Merging non-git releases of a project","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-09T21:33:57Z","receivedAt":"2009-10-09T21:33:57Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"Hi, Thanks!\n\nI'm missing the point here though. Where/when  do I actually add the\nnew pristine code? If I checkout, as you suggest, my initial commit I\njust have (say) v1.0 of the vendor's code. I can't just copy (say)\nversion 1.2 on top as the files probably won't match one-one.\n\nSorry - I'm probably completely failing to understand.\n\n2009/10/9 Avery Pennarun <apenwarr@gmail.com>:\n> On Fri, Oct 9, 2009 at 5:11 PM, Howard Miller\n> <howard@e-learndesign.co.uk> wrote:\n>> Here's my dilemma.... I've used git extensively to track modifications\n>> made to a reasonably large source tree. I do not have access to the\n>> repository for that project, just a given release. I have now acquired\n>> the latest version of that project and I want to 'merge' (not sure\n>> that's the right word in this case) my changes into the new version.\n>> Then I need to carry on using git for further changes. I think it\n>> should be simple but I can't get my head around the best way to do\n>> this.\n>\n> Find out the commitid of the first commit when you checked in the\n> upstream project into git, and call it C1.\n>\n>  git checkout -b vendor C1\n>\n> (replacing C1 with the commitid).  This creates a branch called\n> 'vendor' which is for checking in *only* the pristine code provided by\n> the vendor.  It also checks out this new branch.\n>\n> Next, import the new upstream version of the project and commit it to\n> the 'vendor' branch.\n>\n> Now, switch back to your branch and merge in the vendor changes:\n>\n>  git checkout master\n>  git merge vendor\n>\n> Or, if you want to produce a clean set of patches on top of the vendor\n> version (ie. for submitting the individual patches upstream), you\n> might want something like this instead:\n>\n>  git rebase vendor\n>\n> But be careful, rebasing can make a mess of your history and you\n> shouldn't do it unless you have a good reason.\n>\n> Good luck.\n>\n> Avery\n>\n"},{"id":"124540","messageId":"32541b130910091543x19b3b46an109f90be5c5bfaa2@mail.gmail.com","threadId":"21178","inReplyTo":"26ae428a0910091433v2c959a70g9bfc6c54382f370d@mail.gmail.com","subject":"Re: Merging non-git releases of a project","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-10-09T22:43:50Z","receivedAt":"2009-10-09T22:43:50Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Fri, Oct 9, 2009 at 5:33 PM, Howard Miller\n<howard@e-learndesign.co.uk> wrote:\n> I'm missing the point here though. Where/when  do I actually add the\n> new pristine code? If I checkout, as you suggest, my initial commit I\n> just have (say) v1.0 of the vendor's code. I can't just copy (say)\n> version 1.2 on top as the files probably won't match one-one.\n>\n> Sorry - I'm probably completely failing to understand.\n\nTry this:\n\n   cd mygitproject\n   git rm -rf .\n   cp -a /tmp/wherever/vendor-1.2/. .\n   git add .\n   git commit\n\nDon't worry, git won't double-store files that are identical between\nthe old 1.0 and new 1.2 versions.\n\nAvery\n"},{"id":"124558","messageId":"20091010084742.GB17220@m62s10.vlinux.de","threadId":"21178","inReplyTo":"32541b130910091543x19b3b46an109f90be5c5bfaa2@mail.gmail.com","subject":"Re: Merging non-git releases of a project","fromName":"Peter Baumann","fromEmail":"waste.manager@gmx.de","sentAt":"2009-10-10T08:47:42Z","receivedAt":"2009-10-10T08:47:42Z","isPatch":false,"sender":{"key":"waste.manager@gmx.de","avatar":null},"body":"On Fri, Oct 09, 2009 at 06:43:50PM -0400, Avery Pennarun wrote:\n> On Fri, Oct 9, 2009 at 5:33 PM, Howard Miller\n> <howard@e-learndesign.co.uk> wrote:\n> > I'm missing the point here though. Where/when  do I actually add the\n> > new pristine code? If I checkout, as you suggest, my initial commit I\n> > just have (say) v1.0 of the vendor's code. I can't just copy (say)\n> > version 1.2 on top as the files probably won't match one-one.\n> >\n> > Sorry - I'm probably completely failing to understand.\n> \n> Try this:\n> \n>    cd mygitproject\n>    git rm -rf .\n>    cp -a /tmp/wherever/vendor-1.2/. .\n>    git add .\n\nThis won't commit deleted files from v1.0 - v1.2. Use git add -A to stage all\nmodified and deleted files for the next commit.\n\n>    git commit\n> \n> Don't worry, git won't double-store files that are identical between\n> the old 1.0 and new 1.2 versions.\n"},{"id":"124559","messageId":"26ae428a0910100158s5233841byd303377aa20eb45f@mail.gmail.com","threadId":"21178","inReplyTo":"32541b130910091543x19b3b46an109f90be5c5bfaa2@mail.gmail.com","subject":"Re: Merging non-git releases of a project","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-10T08:58:01Z","receivedAt":"2009-10-10T08:58:01Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"2009/10/9 Avery Pennarun <apenwarr@gmail.com>:\n> On Fri, Oct 9, 2009 at 5:33 PM, Howard Miller\n> <howard@e-learndesign.co.uk> wrote:\n>> I'm missing the point here though. Where/when  do I actually add the\n>> new pristine code? If I checkout, as you suggest, my initial commit I\n>> just have (say) v1.0 of the vendor's code. I can't just copy (say)\n>> version 1.2 on top as the files probably won't match one-one.\n>>\n>> Sorry - I'm probably completely failing to understand.\n>\n> Try this:\n>\n>   cd mygitproject\n>   git rm -rf .\n>   cp -a /tmp/wherever/vendor-1.2/. .\n>   git add .\n>   git commit\n>\n> Don't worry, git won't double-store files that are identical between\n> the old 1.0 and new 1.2 versions.\n>\n> Avery\n>\n\nAdding Unix ignorance to git ignorance... doesn't that delete the .git\ndirectory too?\n\nI don't have cp -a (on a mac) but, IIRC, that's just -rp or somesuch?\n\nBut I see, basic idea is to ditch the files, replace them with the new\nvendor release a commit. I did think of that but it seemed too simple\n:-)\n\nCheers.\n"},{"id":"124560","messageId":"20091010090053.GA4843@atjola.homenet","threadId":"21178","inReplyTo":"20091010084742.GB17220@m62s10.vlinux.de","subject":"Re: Merging non-git releases of a project","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-10-10T09:00:53Z","receivedAt":"2009-10-10T09:00:53Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.10.10 10:47:42 +0200, Peter Baumann wrote:\n> On Fri, Oct 09, 2009 at 06:43:50PM -0400, Avery Pennarun wrote:\n> > Try this:\n> > \n> >    cd mygitproject\n> >    git rm -rf .\n> >    cp -a /tmp/wherever/vendor-1.2/. .\n> >    git add .\n> \n> This won't commit deleted files from v1.0 - v1.2. Use git add -A to stage all\n> modified and deleted files for the next commit.\n\nIt will, the \"git rm\" already cleans the index.\n\nBjörn\n"},{"id":"124562","messageId":"20091010100458.GC17220@m62s10.vlinux.de","threadId":"21178","inReplyTo":"20091010090053.GA4843@atjola.homenet","subject":"Re: Merging non-git releases of a project","fromName":"Peter Baumann","fromEmail":"waste.manager@gmx.de","sentAt":"2009-10-10T10:04:58Z","receivedAt":"2009-10-10T10:04:58Z","isPatch":false,"sender":{"key":"waste.manager@gmx.de","avatar":null},"body":"On Sat, Oct 10, 2009 at 11:00:53AM +0200, Björn Steinbrink wrote:\n> On 2009.10.10 10:47:42 +0200, Peter Baumann wrote:\n> > On Fri, Oct 09, 2009 at 06:43:50PM -0400, Avery Pennarun wrote:\n> > > Try this:\n> > > \n> > >    cd mygitproject\n> > >    git rm -rf .\n> > >    cp -a /tmp/wherever/vendor-1.2/. .\n> > >    git add .\n> > \n> > This won't commit deleted files from v1.0 - v1.2. Use git add -A to stage all\n> > modified and deleted files for the next commit.\n> \n> It will, the \"git rm\" already cleans the index.\n> \n\nYou are right. I missed the \"git\" part and read only rm -rf.\n\n-Peter\n"},{"id":"124619","messageId":"32541b130910110832t7e0b84adt806035bf151a16a0@mail.gmail.com","threadId":"21178","inReplyTo":"26ae428a0910100158s5233841byd303377aa20eb45f@mail.gmail.com","subject":"Re: Merging non-git releases of a project","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-10-11T15:32:23Z","receivedAt":"2009-10-11T15:32:23Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Sat, Oct 10, 2009 at 4:58 AM, Howard Miller\n<howard@e-learndesign.co.uk> wrote:\n> I don't have cp -a (on a mac) but, IIRC, that's just -rp or somesuch?\n\nYou can obtain a non-stupid version of 'cp' (as well as 'ls' and\n'grep' and 'find' and other useful tools) for your mac by using fink.\nBut yes.\n\nHave fun,\n\nAvery\n"}]}