After some tests, I got a better way to do that: Just use git worktree 
feature.

Here is an example:

Suppose you have 2 (or more) projects, and they use a library_XYZ submodule:
/home/projects/project1/library_XYZ
/home/projects/project2/library_XYZ

Then, you just need to do these:

1. Delete /home/projects/project2/library_XYZ
    because the coming worktree command needs no folder there
2. Delete /home/projects/project2/.git/modules/library_XYZ
    no need it anymore, just save your hard disk space. :P

3. cd /home/projects/project1/library_XYZ

4. Create a branch "project2" in /home/projects/project1/library_XYZ
    if you don't have a branch for the coming worktree

5. run "git worktree add ../../project2/library_XYZ project2"
    this is the magic commend. :D


Yue Lin Ho

-- 
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.

Reply via email to