Search code examples
gitgit-svnsvn2git

"git pull <remote> master" into a sub-directory


Background:

I'm trying to move a package from an SVN repo to a GIT repo, while preserving it's history.

Steps:

  • I've used git-svn to generate a GIT repository for the SVN one.
  • I'm following the steps mentioned here to move the code from one GIT repository to the other, while preserving history.

I'd like to move that package into it's own sub-directory in the destination git repository. However, I'm stuck at this step: git pull <remote> master --allow-unrelated-histories

This pulls the code into the top level git directory. How do I pull that code into a sub-directory instead?

I've tried the following based on some SO answers, but that didn't work:

  • git pull -work-tree <working_dir> -git-dir <working_dir> <remote> master
  • git pull -s subtree -Xsubtree=<path_prefix> <remote> master

Clean up step:

The package will be maintained in the destination GIT repo, so I intend to:

  • delete it from the SVN repo.
  • And, also delete the intermediate GIT repo which will not be required once the package has been moved.

Solution

  • If you wanted to import that SVN history into its own subfolder, you would need to import it into its own separate git repo.

    Then you can