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:

  • Exclude some project settings from version control system like Git, TFS
  • Git: rebasing a branch
  • Python way to clone a git repository
  • Cannot move project as it overlaps… Git/Eclipse
  • Unable to create git alias?
  • Creating aliases in PowerShell for git commands?
  •    --trunk
         |-Proj1
         |-Proj2
         |-Proj2
       --branch
         |-Proj1
           |- branch1
    

    etc.

    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?

  • IntelliJ - How to use a different ssh key
  • Using Bundler with Git, is https:// or git:// better?
  • Git-flow, Which are local v remote branches?
  • GIT - Can't ignore .suo file
  • Understanding .gitignore and build directory
  • git reword without resolving merge conflicts again
  • 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.

    Git Baby is a git and github fan, let's start git clone.