Git filter-branch after a git mv, keep all history in subdirectory

164 Views Asked by At

I have a folder structure like described below, and I'm trying to copy anything which is in newCode including history and add it into newCode2.

The issue is that we originally did a "git mv" on oldCode to newCode, so now when I do a "git filter-branch --subdirectory-filter groupB/newCode/ -- --all" it only gives me the history from after the git mv under newCode, and not the history from oldCode.

repoA.git/
   groupA/ 
       (moved)oldCode/
   groupB/
        newCode/

repoB.git/
   groupC/
       newCode2/

Is there a way to get all the history including the history in oldCode?

Related question:

Also, if I had changes that were also made to groupB/somefile.cpp as well as groupB/newCode/somefile2.cpp, what happens when I do a filter-branch and blow away the somefile.cpp if someone were to do a git reset on that file which is now blown away?

Thanks

0

There are 0 best solutions below