简体   繁体   中英

How to handle SVN externals when migrating to Git

I'm currently migrating our SVN repositories to git and I'm not sure how to handle the SVN externals.

I normally would clone and add them as git submodules since I want to keep track of the changes and also push commits to the submodule's repo. Unfortunately git by default clones the whole repo but I only need a subdirectory of it.

The external repo looks similar to this.

external/bar/lib/
external/foo/
external/foo.sln
...

So I thought about using sparse-checkout to only clone the external/bar/lib/ directory to my main project but I'm not sure If I still can do normal git operations like commit , push , pull and branch in the submodule when using a sparse checkout or how to handle the case when I also want to include external/foo/ in my main project.

Ideally, each relevant folder of external/ should have been git-svn exported in their own individual Git repository:

external/bar/lib/ => lib.git
external/foo/ => foo.git

That way, no need to worry about sparse checkout (which would indeed limit the ability to push back commits)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM