user1466700
user1466700

Reputation:

Make private branches with git

I'm somewhat new to Git. So, my task is to make 3 branches, for 3 developers, that would connect only to their branch and work only with their own branch. Something like this:

developer 1 == branch 1
developer 2 == branch 2

Any help or tutorials will be helpful.

Upvotes: 0

Views: 763

Answers (4)

Seth Robertson
Seth Robertson

Reputation: 31471

I suggest you read up on git workflow, either in http://progit.org or in http://sethrobertson.github.com/GitBestPractices

As seanhodges suggested, by default when each developer clones the upstream repo, they will have a private version of the branches, eg master. They can do whatever they want locally. When they are ready to share with other people, they push/pull/etc. There is no particular reason why they need to be on a branch named "dev1". If other people want to look at their stuff, they can by adding the dev's repo as a remote and then they can look at dev1/master.

If you want to do it they way you suggested, you of course can. Just git checkout $USER. People find it more useful to make feature branches (a branch for a particular feature) than user branches.

If you are talking access control, then sure gitolite is probably the best bet as mentioned in the other answer, but really there is no reason why you need to bother except in the most formal circumstances. If a user screws something up, you can always blow those changes away or restore to an earlier state.

Upvotes: 0

seanhodges
seanhodges

Reputation: 17524

All branches created with Git are initially private, and trunk is essentially a branch. What you are describing is the default behaviour of Git.

Take a look at this article on how branch handling differs in Git. Also, this tutorial is useful for people migrating from Subversion to Git.

Upvotes: 3

Sergey Gavruk
Sergey Gavruk

Reputation: 3568

They just should do this:
developer 1: git checkout branch1
developer 2: git checkout branch2
developer 3: git checkout branch3
So they will use their own branches. push will be only to branches that they are checkouted.
But they can use another branch, if they want. So, if you want to deny them to use another branch, just create separate repository for every developer.

Upvotes: 0

Rafał Rawicki
Rafał Rawicki

Reputation: 22690

Git doesn't contain any access control by itself.

Gitolite is a Git server, which offers access control including setting access for distinct branches.

Upvotes: 0

Related Questions