Re: [git-users] Re: git rewrite history for multi module project
Unbelievable. Its working! Many thanks Thomas, you have been a great help It is even working with a complexer directory structure. I think with one try it didn't detect the correct parents, but if I choose one of the parent commits to be the last commit in the old repo, where all contents have been deleted, it will still be detected during the fake merge. Maybe the only down side of this approach is that you have to specify git log --follow instead of just git log. but never the less great solution. For anyone in the future reading this and want to know which commits to use as parents and child in the graft point. I searched for the first commit in the new repository where hundreds of files have been added and considered this as parent1. Its child commit in the new repository is the child in the graft point. Finally I chose the commit in the old repository where the same hundreds of files have been removed. If no such commit exists (I also have this case), then choose the last commit in the old repo Maybe an even better approach would be to create a brand new merge commit to contain the files remove and add, and to replace the first commit in the new repository with this one. Cheers -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Re: git rewrite history for multi module project
Unfrotuantly it is not working the way described, but maybe I'm doing something wrong:(, here goes -created two git repos, mainproject and project1 - created a project1/subproject1/readme, did some dummy commits to readme - to simulate svn move, I copied project1 under mainproject,and removed mainproject/project1/.git directory obviously, then committed as the first commit in the new repo - removed the contents of project1/ and committed that as last commit in old repo - comitted a second commit in the new repo with dummy changes to readme - Now in order not to mess with this installation, I created a new project that fetched both projects - Created a graft point with second commit first commit last commit from old repo - and called git filter-branch --tag-name-filter cat -- --all - it rewrote the new repo branch, but it didn't create second commit as the merge commit, it still can not recognize the moved files, also with follow any ideas? On Wednesday, May 14, 2014 10:22:44 PM UTC+2, Thomas Ferris Nicolaisen wrote: On Wednesday, May 14, 2014 9:19:37 PM UTC+2, Moataz Elmasry wrote: Aha that would be exactly what I'm looking for, how can one define the first commit in mainrepo as a merge commit of several repositories. Only using graft point with one child and several parents does not allow me to follow a file history from main project through the older projects Hm, let's say that the first commit in the mainRepo is abc123. It's basically just a commit where a thousand files are added. You then do the grafting. The commit abc123 is then rewritten to not only be thousand addeded files, but also a thousand removed files, as the files are being moved from their old-structure location. Git doesn't track any renames, it does rename detection upon inspection. Simply explained, if in a commit a file is removed, and another file is added which looks very similar, Git will consider this a rename in the moment you run git log. Of course it doesn't work perfectly in all cases, and I assume that graft points is one of these. Before you make any conclusions, make sure to finalize the grafts as explained herehttp://thomasrast.ch/git/git-svn-conversion.html (good read for anyone doing grafting): git filter-branch --tag-name-filter cat -- --all Also keep in mind that you have to use git log *--follow* to view the history of a file across renames. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Re: git rewrite history for multi module project
On Thursday, May 15, 2014 11:02:35 PM UTC+2, Moataz Elmasry wrote: - removed the contents of project1/ and committed that as last commit in old repo Why this? Try again, and this time leave this step out. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Re: git rewrite history for multi module project
On Wednesday, May 14, 2014 7:27:53 AM UTC+2, Moataz Elmasry wrote: Hi Thomas and thanks for your reply Why should I slice the main project? it is good the way it is. I need to append to it from the back ,i.e. earlier commits and the final state should be the main project including the commits from the time it was multiple modules/multiple trunks Ah, I incorrectly assumed that you wished to split into more fine grained repositories again. It could still be that this is still the best approach to get a *correct* history for each sub-project. After you've got them all grafted properly and you want to bring them together in one repository again, you could use something like git-stitch-repohttp://search.cpan.org/dist/Git-FastExport/script/git-stitch-repo . If you don't care that much about correctness, you could just graft the first commit in the mainProject repo into being a merge-commit of all the last commits in the old subprojects: last commit in subrepo1__ last commit in subrepo2_ \ \ | first commit in mainRepo (4 parents) last commit in subrepo3_/ | last commit in subrepo4__/ In this case, it will look like all the files from the subprojects are moved into their respective folders in the first commit in mainRepo. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Re: git rewrite history for multi module project
On Wednesday, May 14, 2014 8:15:25 AM UTC+2, Thomas Ferris Nicolaisen wrote: On Wednesday, May 14, 2014 7:27:53 AM UTC+2, Moataz Elmasry wrote: Hi Thomas and thanks for your reply Why should I slice the main project? it is good the way it is. I need to append to it from the back ,i.e. earlier commits and the final state should be the main project including the commits from the time it was multiple modules/multiple trunks Ah, I incorrectly assumed that you wished to split into more fine grained repositories again. It could still be that this is still the best approach to get a *correct* history for each sub-project. After you've got them all grafted properly and you want to bring them together in one repository again, you could use something like git-stitch-repohttp://search.cpan.org/dist/Git-FastExport/script/git-stitch-repo . If you don't care that much about correctness, you could just graft the first commit in the mainProject repo into being a merge-commit of all the last commits in the old subprojects: last commit in subrepo1__ last commit in subrepo2_ \ \ | first commit in mainRepo (4 parents) last commit in subrepo3_/ | last commit in subrepo4__/ In this case, it will look like all the files from the subprojects are moved into their respective folders in the first commit in mainRepo. Aha that would be exactly what I'm looking for, how can one define the first commit in mainrepo as a merge commit of several repositories. Only using graft point with one child and several parents does not allow me to follow a file history from main project through the older projects thanks for the stich-repo script, I'll check it out when I'm home cheers -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Re: git rewrite history for multi module project
On Wednesday, May 14, 2014 9:19:37 PM UTC+2, Moataz Elmasry wrote: Aha that would be exactly what I'm looking for, how can one define the first commit in mainrepo as a merge commit of several repositories. Only using graft point with one child and several parents does not allow me to follow a file history from main project through the older projects Hm, let's say that the first commit in the mainRepo is abc123. It's basically just a commit where a thousand files are added. You then do the grafting. The commit abc123 is then rewritten to not only be thousand addeded files, but also a thousand removed files, as the files are being moved from their old-structure location. Git doesn't track any renames, it does rename detection upon inspection. Simply explained, if in a commit a file is removed, and another file is added which looks very similar, Git will consider this a rename in the moment you run git log. Of course it doesn't work perfectly in all cases, and I assume that graft points is one of these. Before you make any conclusions, make sure to finalize the grafts as explained herehttp://thomasrast.ch/git/git-svn-conversion.html (good read for anyone doing grafting): git filter-branch --tag-name-filter cat -- --all Also keep in mind that you have to use git log *--follow* to view the history of a file across renames. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Re: git rewrite history for multi module project
Hi Thomas and thanks for your reply Why should I slice the main project? it is good the way it is. I need to append to it from the back ,i.e. earlier commits and the final state should be the main project including the commits from the time it was multiple modules/multiple trunks On Tue, May 13, 2014 at 11:09 PM, Thomas Ferris Nicolaisen tfn...@gmail.com wrote: On Tuesday, May 13, 2014 4:16:14 PM UTC+2, Moataz Elmasry wrote: Is it possible to build this relation, for example using git branch-filter --tree-filter? lets say the last commit in svn/project1/subproject1 is x, while this project was moved under svn/mainproject/trunk/project1/subproject1/ in commit y, how can I build this relation? I think this should be possible. Try focusing on one project at a time, probably easier to get started this way. So you have already created git-svn clone of project1/subproject1 the way it was in the old structure. So far so good, now you want to append the history of subproject1 in the new structure. You start off with the big mainProject trunk. You then want to slice out everything of this project but subproject1. First make a clone, and then use filter-branch like this: # make a copy of the big project you can morph into being just subproject1 repo: git clone --no-hardlinks mainProject-git-svn-clone subproject1 cd subproject1 git filter-branch --prune-empty --subdirectory-filter _Project1/subproject1 HEAD # wait till it's done, and you should have the latest contents of subprojec1 in the current dir git remote add older-stuff ../subproject1-older git fetch older-stuff Now you can start grafting together old and new stuff. Use gitk or git log to get a sense of where the graft points should be. The downside of this is that filter-branch will only bring the current branch (trunk) along for the ride, so if you want to keep any other branches you'll have to do them separately and graft them in as well. -- You received this message because you are subscribed to a topic in the Google Groups Git for human beings group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/git-users/VOXdij452YE/unsubscribe. To unsubscribe from this group and all its topics, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Re: git rewrite history for multi module project
In other words, I want to say assuming mainproject and subproject1 are both git repos, then for path mainproject/project1/subproject please append from the back all commits from subproject1 Another idea, what if I fetched the two origins, then rebased mainproject on subproject1, then merged from subproject1 back into mainproject? On Wed, May 14, 2014 at 7:27 AM, Moataz Elmasry zaza185198...@googlemail.com wrote: Hi Thomas and thanks for your reply Why should I slice the main project? it is good the way it is. I need to append to it from the back ,i.e. earlier commits and the final state should be the main project including the commits from the time it was multiple modules/multiple trunks On Tue, May 13, 2014 at 11:09 PM, Thomas Ferris Nicolaisen tfn...@gmail.com wrote: On Tuesday, May 13, 2014 4:16:14 PM UTC+2, Moataz Elmasry wrote: Is it possible to build this relation, for example using git branch-filter --tree-filter? lets say the last commit in svn/project1/subproject1 is x, while this project was moved under svn/mainproject/trunk/project1/subproject1/ in commit y, how can I build this relation? I think this should be possible. Try focusing on one project at a time, probably easier to get started this way. So you have already created git-svn clone of project1/subproject1 the way it was in the old structure. So far so good, now you want to append the history of subproject1 in the new structure. You start off with the big mainProject trunk. You then want to slice out everything of this project but subproject1. First make a clone, and then use filter-branch like this: # make a copy of the big project you can morph into being just subproject1 repo: git clone --no-hardlinks mainProject-git-svn-clone subproject1 cd subproject1 git filter-branch --prune-empty --subdirectory-filter _Project1/subproject1 HEAD # wait till it's done, and you should have the latest contents of subprojec1 in the current dir git remote add older-stuff ../subproject1-older git fetch older-stuff Now you can start grafting together old and new stuff. Use gitk or git log to get a sense of where the graft points should be. The downside of this is that filter-branch will only bring the current branch (trunk) along for the ride, so if you want to keep any other branches you'll have to do them separately and graft them in as well. -- You received this message because you are subscribed to a topic in the Google Groups Git for human beings group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/git-users/VOXdij452YE/unsubscribe. To unsubscribe from this group and all its topics, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Git for human beings group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.