Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In a single directory with a Git root folder, I have a bunch of files. I am working on one of those files, X.py, with my friend Alice. The other files I am working on with other people. I want Alice (and everyone else) to have access to X.py. I want Alice to only have access to X.py though.

How can I achieve this with Git? Is there a way I can split a directory into two repos? That sounds rather cumbersome. Maybe I could add a remote repo that Alice can access containing X.py?

share|improve this question
3  
Don't share the repository. Instead, have Alice send you updates / patches as needed. –  parsifal Mar 26 '13 at 21:08
    
@parsifal You should add that as an answer –  Demizey Mar 31 '13 at 15:36
add comment

2 Answers

If it was SVN you could easily handle this with permissions, but most DCVSes don't have that fine-grained permissions as that is completely unworkable with everyone having a copy of the repository.

Probably the best way to handle this would be to have alice fork the repository and submit pull requests -- you could then make sure she is just working in X.py and not anything else.

If you don't want her reading anything else then you'd need to work with subrepos. But as a great man once said "when you've got a problem and you say 'hey, I'll use subrepositories' then you've got two problems."

share|improve this answer
add comment

You make a branch X and delete everything except X.py and the push the branch to a central repository. If you want to share Y.py also, you add it to your branch and you merge this branch with X from the central repository.

You don't push to the central repository anything that you don't want to be seen by others.

share|improve this answer
1  
Unfortunately, if you want the remote branch to be mergeable, it must contain all the history from before you deleted the other files. –  Karl Bielefeldt Mar 26 '13 at 23:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.