This is the workflow we use on projects for our customers. We know it won't suit everyone as it depends upon our particular circumstances, but if it's useful to anyone else, please drop us a comment.
- We are a small company and our projects tend to have small teams of trusted developers.
- Our customers rarely have experience of development work and are unfamiliar with tools like git or issue trackers.
- We want to provide our customers with access to code that we have written for them and a system for them to record issues that they find.
- We do not want to expose our 'work in progress' to our customers either during the course of development or even when the work is complete.
- We use github as the customer interface. Our customers' staff register accounts and join our github teams where they can see the code we produce and use the issue tracking and wiki functionality.
- The github repository for a given project only contains a 'master' branch and we only ever commit working, tested code to that branch.
- We run an internal git server to allow developers to collaborate on work in progress.
- We configure two remotes on each developer's repository. They are always named 'github' and 'empiria' and point to the github and internal server repositories.
A developer starts work on a change and creates a new branch in her local repository.
We call this a 'Personal Branch.' There's nothing special about it - no security that it makes it especially 'personal' - it's just the term we have agreed upon to describe this type of branch.
She commits to this personal branch as she progresses. She also rebases it regularly from the master branch to take account of any changes that may have been released.
Once the work is tested and complete, it is merged into the master branch which is then pushed to github.
We use the --squash option so that only one commit is added to master for that entire change, regardless of the number of commits on the personal branch.
Once github is up to date, she deletes the personal branch.
A developer realises that he is going to need some help from a colleague on a particular piece of work. He pushes his personal branch to our internal git server and his colleague pulls the work from there.
We call the branches on our internal server 'Collaborative Branches.' Again, there is nothing special about them as far as git is concerned. It's just the term we've chosen to describe that type of branch.
We now refer to his local branch as a 'Tracking Personal Branch' (and the same term applies to his colleague's local branch).
The two developers commit to their tracking personal branches and push and pull their work to and from the collaborative branch. They have to rebase their work regularly from the master branch and have to be careful to agree who is responsible for rebasing.
When the work is tested and complete, it is merged into the master branch, pushed to github (in exactly the same manner as for a personal branch) and the tracking personal and collaborative branches are deleted.