Status.
I have http://drupal.org/project/pdf_to_imagefield which has a shaky, non-working D7 branch open
InternetDevels.Com has rewritten it as http://drupal.org/sandbox/InternetDevels.com/1415404
and that's pretty much a total replacement, with not a lot in common any more.
I suspect that there is a git-wizard way of bringing/merging that into this project, pulling whatever history with it. History is not vital in any way, but I'd like to learn if there was a way to do this properly.
In my naive get-r-done way, I can imagine
* branching my project to a 7.x-2.x branch
* git deleting everything
* manually copying the replacement files into there and re-adding.
I'm pretty sure that would work fine.
But I'd like to know if anyone can suggest a power-user git way that would do it the "right" way. Can I get git to say "make a new branch using the files from a different repo and make them my own from now on"?
Thanks!
Comments
Based on some searching at
Based on some searching at http://stackoverflow.com/questions/2949738/git-merge-different-repositories
I'm looking at something like:
At this point I get
Which is not altogether unexpected.
Am I on the right path?
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Second attempt.It feels like
Second attempt.
It feels like this is not a lot different from my handmade delete-and-replace method, but it does at least let git get involved in the process.
I think I'm in the right state now.
Am I right?
Should I have deleted the files before branching? does the new branch have these old files added and removed as the first part of its history? Probably doesn't matter, but could I have done something to ensure my new branch STARTED empty?
.dan. is the New Zealand Drupal Developer working on Government Web Standards
The above steps seem to have
The above steps seem to have worked successfully. The bonus above doing it by hand is that The developer who built it in their sandbox gets proper attribution (and blame) in the git history in this project. This is excellent.
Even though I only just added InternetDevels.com as a maintainer, there are already commits showing up on the project page. I like this.
The above steps were followed up with a
to finally push these changes and the new branch back to d.o.
.dan. is the New Zealand Drupal Developer working on Government Web Standards
can do from github too
Update. The same process worked (with minimal issues) when pulling from a github repository and merging it to a project also.
I needed to set
in order to get at github in the first case, and I needed to re-add the files with
after the merge command (not sure why it's different this time) but after that, I ended up with a new D7 branch that started life somewhere else entirely.
.dan. is the New Zealand Drupal Developer working on Government Web Standards
git cherry-pick
When trying to upgrade jquery-freebase, timplunkett from #drupal-git IRC, adviced using git cherry-pick, that is if you plan to be meticulous on what changes you want to pull to your project, in case of a pull request or something.
If the code is cousins
It appears that cherry-pick can work if the code has a common ancestor. I hadn't actually realized that your github branch was a true cloned branch of the original project. So yes, it should have been possible to re-merge via cherry-pick in this case.
In my other use-case previously, the code I was trying to import had lost its historical roots to the original, so it was (probably?) unable to to be cherry-picked in in the same way. Also, I'me not reviewing changes, really just happy with a complete overwrite.
But thanks. it's worth further investigation next time I have to do this!
.dan. is the New Zealand Drupal Developer working on Government Web Standards