2

I have the typical problem of splitting up one large repo into smaller ones, so I searched and came across this: http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/

git clone <git repository A url>
cd <git repository A directory>
git remote rm origin
git filter-branch --subdirectory-filter <directory 1> -- --all
mkdir <directory 1>
mv * <directory 1>
git add .
git commit

It would have worked for me, except that my clone is a shallow one. Since the repo is large, I had to clone with depth 0.
Now, what are my options?
Should I:

  • Clone the repo at its full depth in the first step (OR)
  • Not detach the remote in Step 3 and fetch all after filtering subdirectories (OR)
  • Do anything else?
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Merrin
  • 655
  • 2
  • 7
  • 18

1 Answers1

1

Even without cloning again, you can convert your current repo from shallow to "unshallow"

git fetch --unshallow

Then, you can proceed with your git filter-branch

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250