0

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?

asked Mar 26, 2013 at 20:26
2
  • 3
    Don't share the repository. Instead, have Alice send you updates / patches as needed. Commented Mar 26, 2013 at 21:08
  • @parsifal You should add that as an answer Commented Mar 31, 2013 at 15:36

2 Answers 2

1

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."

answered Mar 26, 2013 at 20:44
0

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.

answered Mar 26, 2013 at 20:58
1
  • 1
    Unfortunately, if you want the remote branch to be mergeable, it must contain all the history from before you deleted the other files. Commented Mar 26, 2013 at 23:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.