Used
Git, Github.com
Problem
I have a project with files: A, B, C, D, E.
- I would like Team 1 work on: A, C, D (do not want to expose B, E to them)
- While Team 2 work on: B, D, E (do not want to expose A, C to them)
- And I would like to work on: A, B, C, D, E
Then I pull Team 1 work and get A, C, D merged with my work and then pull Team 2 work and get B, D, E merged with my work.
I can create a repo per team if needed.
Not working
I have read all articles and tried everything they provided.
- Submodules not working for me - files are in different locations and I will need to ignore different bunch of files for each developer team
- Excludesfile per branch just doesn't work
- .gitignore will delete those 2-3 files when I pull
I do not want to believe there is no easy and elegant solution just to ignore some files per push or branch or remote repo or something else...
Additions
- I cannot separate one project into several projects
Git has no access-control, so: "git", "secret files", and "easy to maintain" just doesn’t mix well. Look at gitolite and Git on the server - gitolite if you want to add an access control layer.
You will need to experiment, but you can probably work along the lines of starting with an empty repo, and having a branch per-team. Note however that you don’t want the files appearing in any of the respective branch histories. For example, you don’t want to have a master branch with all the files, that you branch as a
team1
branch, and thengit rm
the files. The “secret” files will remain in the branch history, and restricting access won't help. So you will either have to have a clear separation for the files across branches, or have a sanitation script that appliesgit filter-branch
to remove files every time you decide to merge and run the risk of introducing the files again.To elaborate on the last example. Suppose you merged
team2
work into your master branch and now want to share the overall progress withteam1
. You cannot simply mergemaster
intoteam1
, but you can branchmaster
asmaster-sanitized
, runfilter-branch
to remove the filesteam1
shouldn't see, and then mergemaster-sanitized
intoteam1
, discarding the temporary branch. However all that won't save you from the fact that rewriting commits is actually re-introducing them with new sha1-s, so your merges will be a constant pain of conflict resolution with-s ours
or-X theirs
.I would create three projects:
I would further split projects if I envisage ever wanting finer access control that separates A from C or B from D.
I don't think I would try to use ignore files for access control.