Quick git workflow for small teams

Uncategorized

Here is a simple and straightforward way of using git in small teams. I have tried different approaches and think this works well for teams up to a size of 5 people. Beyond that, you may incorporate some more sophistication in the workflow, but that can be in a different post.

For this post, assume that the team is set up with github as the remote from where everyone cloned. I won’t go into the details on how to clone from github and get setup with remotes etc. If you follow simple steps, this is a very standard configuration. However, if you do need help with this, try one of these useful books.

Master should never be broken

The master is the branch that is never broken. It is the branch that is deployed to the production site. You should always have full confidence that deploying the master doesn’t break anything.

git workflow small teams

The workflow

Before you start working on a feature do this:

git checkout -b my-awesome-feature

As you make your changes you can commit them

git commit -m "made an awesome change"

To back things up, also just push your branch up to your remote. The following command will automatically create a branch called “my-awesome-feature” on your remote and your commits will be available there cleanly in a separate branch

git push origin

To make sure the world hasn’t changed too much since you started working on this feature, you want to grab the latest from master and make sure your changes are still valid on top of it. If you rebase often, you will have less surprises when you merge.

git rebase master

Happy with what you have? create a pull request. Go to Github, find the repo, look for your branch and select “create pull request”. This way someone on your team can review your changes and give you a quick code review. When they are happy with your work, they can press the “single green button” to merge that into master.

Now, master has the latest code, so you can delete your branch safely.

git branch -d my-awesome-feature
git push origin --delete my-awesome-feature

Deploy the master to your production server using whatever deploy method you like. It could be heroku, or your own server with shell scripts, build or CI system or whatever floats your boat.

2 thoughts on “Quick git workflow for small teams

Leave a Reply