English 中文(简体)
How to manage backups and monitor Git with a central repository?
原标题:

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?

最佳回答

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.

问题回答
  • Backup individual repositories

  • Create a "backup" repository, to which other push finished work into refs/remotes/<username>/ namespace:

    [remote "backup"]
        url = user@backup.example.com/srv/git/backup.git
        push = +refs/heads/*:refs/remotes/user/*
    
  • Use Gerrit: see "Gerrit: Google-style code review meets git" article at LWN.net





相关问题
Backing up my database is taking too long

On a windows mobile unit, the software I m working on relies on a sdf file as it s database. The platform that the software is targeted towards is "less than optimal" and hard resets every once and a ...

Cognos LAE Backup Automation (Batch File?)

Within Cognos 7.4 security.. one would create an LAE file to export all their users... directions here... http://www.cognos-install.co.uk/articles/backups/access_manager_export_to_lae.asp Now you ...

backup SQL Server 2005 database without data

I have one stored procedure to backup the database. It will backup metadata as well as data. Is there any option to back up the database with out data. ie, back up only the schema (Empty tables). I ...

SQL Server 2008 Auto Backup

We want to have our test servers databases updated from our production server databases on a nightly basis to ensure we re developing on the most recent data. We, however, want to ensure that any fn, ...

mysql dump stops when a row is updated

When i try to get a dump of a mysql database, the dump stops when a row in it is updated. How can i prevent that? I already tried following options with no result: -f (forces continu even when error)...

热门标签