I have got a repository at github and several branches. The whole repo is about 2 gigs. Before moving to git, I had an ant script that would checkout a folder from svn repository, build binary files and then commit back to the repository.
Unfortunately after switching to git, I can’t find a simple way to do it. Every time my ant script runs, I want it to get a fresh copy of folder from remote branch and commit back to it after doing some work. I do not want to download whole repsitory ( 2 GB of Data ) everytime I run ant script.
Here is an example of how my ant script looked with SVN
- SVN CHECKOUT FROM http://project.branch15/subfolder/subfolder/subfolder
- MODIFY SOME STUFF in /subfolder/subfolder/subfolder
- SVN COMMIT BACK TO http://branch15/subfolder/subfolder/subfolder
With GIT workflow looks like
- GIT INIT
- GIT CLONE http://project.branch15 ( 2 GB )
- MODIFY SOME STUFF in /subfolder/subfolder/subfolder
- COMMIT branch 15
This sounds like you have too much stuff in one repository. You should refactor it to use submodules. *If there is a folder than can live independent of their ancestors or siblings then it is a good candidate for a submodule.
Git submodules are themselves git repositories and thus can be clones, checked out, modified and pushed to independent of the parent repository.
You can also have a hierarchy of submodules. So in your example each subfolder could be a submodule. (but you should heed the above *).
Another advantage of this approach is that you can clone the main repo (which might be 2GB) and assuming it is made up of some submodules (say 10 of ~200MB) without taking up the full 2GB. Then you can run submodule checkouts for the repos that you do want.
Here is an example:
File structure
If the ^ folders are each a submodule you could do the following