0

Recently I migrated from SVN to GIT using git-svn.

Actual size of checkeded out code is ~24GB. In GIT, currently I see only once branch as origin/master. Hence if each developer clone master, he need to pull 24GB everytime, which is real pain.

So, I need to Mark some of the existing locations as branches, so that those can be checked out directly, instead of full repo.

project repo structure is like:

/Docs/
/project-maintainance/
/main-project/
             /module1
                    /branch1  
                    /branch2  
             /module2
                    /branch1  
                    /branch2
                    /branch3

Now, to accomplish this task, I want to Mark some specific folders as branch, instead of creating new branches. I browsed through so many webpages, but it only increased my confusion as I'm a beginner.

How can branches be created from subfolder instead of top level folder?

Edit: Right now my aim is to be able to checkout multiple subtrees, push and pull changes.

rohit
  • 485
  • 1
  • 7
  • 12

1 Answers1

0

Unfortunately, git does not work like this as it is a distributed version control system (DVCS). This means that you have an entire copy of the code and not just part of it.

However, it is possible to do what is called a shallow clone. For example:

git clone <repo> --depth 1

This approach comes with various caveats - you can find plenty more discussion here.

Ultimately, 24GB is extremely large for a git repo. In fact I've never heard of such a large repository before. It may be worth investigating trying to drastically reduce it in size using the filter branch command.

I have written a Ruby gem - which is still in early development - that provides some basic stats about your git repository such as large files in your history (and no longer in your working copy) that may be suitable candidates for removal using filter branch.

Another option could be to split your single repository into multiple ones. I can't strongly recommend this as I don't know how your code fits together, but there is a great discussion here.

Community
  • 1
  • 1
ben.snape
  • 1,495
  • 10
  • 21
  • Yes it is very large repo. `Shallow clone` will not work my requirement as I cannot ignore any history or file depth. I thought of splitting projects into different repos but it needs a huge effort and change. Right now my aim is to be able to `checkout multiple subtrees, push and pull changes`. – rohit Feb 21 '13 at 13:19