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.

Is it considered a good practice to have a remote branch for each individual developer in the project?

We're using Git with the following branches:

  • master
  • release
  • develop

If each developer had their own branch, they could push code into their branches and others could merge these changes into their own branches.

share|improve this question

migrated from superuser.com Feb 28 '13 at 13:16

This question came from our site for computer enthusiasts and power users.

    
Reminds of me Accurev workspaces, except not tied to a particular machine's MAC address. I like it. –  Brandon Feb 28 '13 at 13:21
    
possible duplicate of To branch or not to branch? –  gnat Feb 28 '13 at 13:55
1  
Why nat have a unique branch for each new feature being added? –  Loki Astari Feb 28 '13 at 15:28
    
@Loki Yeah.. its a good idea.. –  balanv Mar 1 '13 at 5:16
add comment

5 Answers

up vote 2 down vote accepted

No! It is a good practice to have a remote branch namespace for each developer.

A single branch is often not enough, so the developer would either end up rewinding it a lot or it wouldn't be helpful much. You rather want to say that a developer can push whatever they want under their.name/. They can use it for publishing preview versions for others, giving version for somebody else to test or even for somebody else to integrate.

You can use this also for giving branches to integrator or you can use task-based names. The task-based names are usually easier to track for the integrator, but make developers think more about the naming and people don't like thinking. I don't know which will work better in practice; might even depend on the particular team.

share|improve this answer
add comment

If you're working with Git, you should try out Pull Requests.

In summary, you first merge the master branch into your current working branch. Any merge conflicts will be in your local branch. This is nice because your master branch is never broken. If you really screw up, you have you local commit that you can revert to.

Once you finish the merge, you ask someone else on the team to review and merge your branch into the master branch. Never merge your own! So long as no one sneaked in and did another Pull Request, you're guaranteed to merge successfully. Since everyone is aware of the Pull Request, you shouldn't have multiple people merging into master at the same time anyway.

Once you get used to this process, you should try to merge as often as possible - sort of a poor man's continuous integration. The less time between conflicts the better. You'll identify when two people are duplicating effort and they can team up. Some places will merge every time they complete a requirement, which could be every couple hours. I recommend merging at least once a week; otherwise you need to break your tasks out better.

I typically create one branch per task. Git is nice because it distinguishes between local commits and pushes. This provides some of the benefit of each person having their own branch without all of the complexity.

share|improve this answer
add comment

I probably wouldn't give each developer a branch on the central server unless you have some sort of github-style infrastructure that allows them to create and destroy the branches themselves and clearly document what they are for. Some developers will need more than one branch and some won't need any at all, but you're creating clutter for everyone to sort through and administrative overhead for yourself.

I would encourage instead the kind of organic sharing git excels at. It's very easy to make a bare clone on your own machine, and make that folder a read-only SMB share for others to pull from. In fact, it would surprise me very much if several of your developers are not already doing this.

share|improve this answer
1  
By default everybody can always create a branch. Github allows creating whole repositories, but that is overkill in this case. –  Jan Hudec Feb 28 '13 at 14:04
add comment

Giving each developer their own branch can be helpful if they are all working on different things that may touch the same files. It can help prevent stepping on each others toes, but it will require every one to merge often and be responsible when managing conflicts. This is what is done in my office and it works pretty well apart from the rare day you have to manually merge half the files you edited.

If you have multiple developers working on the same feature its probably better to create branches based on the feature in development rather than the developer.

share|improve this answer
add comment

It depends on how your development team and tasks are organized. In my opinion, the model you specified would work best if:

  1. Each developer works on independent tasks by themselves.
  2. All developers are contributing to the same task.

Where this might not work well is if you have concurrent feature projects in development and they each have multiple developers working on them.

share|improve this answer
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.