Create a branch for one subdirectory only
This is a conceptual question, rather than “how do I?” question.
I’m helping migrate a very big SVN repository to a Git repository for a team.
I’m simplifying a bit, but let’s assume that their current repo structure is like this:
--trunk |-Proj1 |-Proj2 |-Proj2 --branch |-Proj1 |- branch1
They (owner team of the repo) insist, that it should go to a a single Git repository, not each project in its own. Let’s assume that I cannot persuade them otherwise. (I suspect they’ll come around, when they start using Git and understand this is impractical.)
Each of ProjN in SVN is getting branched independently of others.
My question about Git, when I branch, can I branch a subfolder of a repo (that is just Proj1) not the whole repo? My gut feeling is that you are always supposed to branch git at the top level. Am I wrong?
One Solution collect form web for “Create a branch for one subdirectory only”
You can’t branch a subfolder. Branches always apply to the whole worktree.
I suppose git submodules are what are you looking for. You can think of them like “nested git repositories”.
See also Git Submodules SO Docs.