views:

313

answers:

2

I'm on a team using Git right now, and we have a pretty good workflow. We have a central repository with two branches, dev and master. We create local branches to work on individual tasks. We merge into dev when they are ready. Then we merge to master when things are ready, and we tag all of our releases. If multiple developers need to cooperate on a task more directly, we can create another, possibly temporary, remote branch for them to share patches through. This is working out pretty well for us, but it leaves us with two problems.

One problem is the issue of backups. Sure, most of the code base is backed up. Every machine that has a clone of the repository has most of the code. However, the code that someone writes during the course of a day is not backed up until they merge to dev and push. If the task they are working on is non-trivial, it could be days before they have anything merge and push worthy. How do we make sure this work in progress code is backed up in a central safe place? Just use some backup solution external to Git?

The second problem is the issue of monitoring employee progress. The manager(s) want to be able to see what code the developers have written each day. If a day goes buy where you didn't push anything out, it will look like you didn't do anything all day. We need some way to show our work on a daily basis that doesn't force us to commit and push code that isn't ready for committing, merging, and pushing.

One solution we considered is to create a remote branch on the central repo for every single local branch we make. This would probably work, but it would be a big cluttered mess, even if we regularly deleted old unused branches. It's also a lot of extra work to manage all that.

How can we satisfy these business requirements without disrupting our Git workflow?

+2  A: 

You could consider doing something like this. Use a non-branch namespace for private developer backups. E.g. refs/backups/xxx/* where xxx is the developers user id or initials or similar.

A developer can then do git push origin +refs/heads/*:refs/backups/xxx/* to back up all his local branches.

By default, developers don't see each other's private backups, but they are retrievable if necessary.

The backup push formula can be made into a git backup command via an alias.

Much as I think it's not a good idea, a developer's private branches can be used to see his 'progress' it sounds a lot like micro-management.

Edit: When writing it, this felt quite familiar and then I remembered why. I wrote about something similar in response to another question a while ago: link.

Charles Bailey
That's a good solution for backups. However, how can someone else check out my backups?
Apreche
Yes, for us this is a 'feature' not a problem. If you want truly private backups then you really need a seperate backup repository per-user.
Charles Bailey
+2  A: 
Jakub Narębski