tags:

views:

213

answers:

4

I have a repository which contains Content & Source files. Developers should work only on source files. To save space, developers should not clone the content files (which are in GB) to their local repo. Source files are not present in the project as sub-modules rather they are in the same location where the contents are.

My approach is like this - I created a branch Source from Master and then deleted the content files from that branch. And I published the same branch for cloning to the developers.

As I am merging the changes from the Source branch back to Master, the content files are getting deleted in Master. How to restrict it? And if it is not possible then is there a way to achieve my requirement of having a separate branch / clone having only filtered files i.e. the source files in it?

+2  A: 

You shouldn’t have removed the files from the Source branch at all. If Source and Master are only branches in the same repository your developers will have the content anyway; there’s no harm in having it lying around.

Bombe
The type of content files are flv, wmv, pdf, doc which sizes more than 200GB. It will put an immense overhead on network during remote cloning as it is cross-location development team. And I think it is going to be a performance bottleneck for Git as well to scan such huge amount of files to detect change in some source files.
kaychaks
“You think”? So you got in action without checking whether that really is a problem first? Duh. 1) My point still stands: if Source and Master are branches in the _same_ repository they will be cloned to the developers’ machines anyway. 2) How often do you plan on cloning complete repositories? 3) Git uses file modification times first; only if those differ, the content is checked. No loss here. 4) Let your remote team clone the repository once, then let the people over there clone that repository. Easy as pie.
Bombe
+5  A: 

The obvious answer is that you should have separate source and content repositories. Or just leave the content be.

Oddmund
kaychaks
+1 Agreed. In my own CMS project, I have a root project which contains the code, a test project which contains small example data files for testing and a content project which is the main thing and contains only config and content.
Aaron Digulla
@kaychaks: Get the source for the app framework and fix the bug. If you can't get the source, file a bug report.
Aaron Digulla
@kaychaks: Mixing several repositories in the same folders or sub-folders is generally a very bad idea. Even though it can be done, it's asking for trouble.
Oddmund
A: 

Are you sure you want to include those media/doc files in your repo? Do you want to track changes of a 200GB media library?

If you put their owner dir reference in a .gitignore file when you are on your source branch, git will ignore those files, thus won't touch/delete them.

http://www.kernel.org/pub/software/scm/git/docs/gitignore.html

Vili
It will only ignore them if they are untracked—which I think they are not.
Bombe
A: 

Use git-merge to merge the two branches, and then git-revert to remove the commit that deleted the content files.

% git checkout Master
% git merge Source
% git revert <content-removal-commit-id>

Or you could do it the other way around, and remove the content-removal commit before you merge into Master. It's a little more complex, but it might keep your Master history a little cleaner.

% git checkout Source
% git branch SourceMerge
% git checkout SourceMerge
% git revert <content-removal-commit-id>
% git checkout Master
% git merge SourceMerge
rampion