A typical workflow for a team using Git

Lets assume you are in a team, working on a Rails project and you have chosen Git as your version control system. One way to complete a working cycle from pull to push is:

DISCLAIMER: There are more ways and many situations that are not described here. This is only a note to self that may also be useful to you.

Pull from your remote repository to make sure everything is up to date

[shell light=”1″]git pull origin master[/shell]

Create a new local branch for keeping your changes way from your local master branch

[shell light=”1″]git branch my_new_feature[/shell]

Switch to that branch and start working

[shell light=”1″]git checkout my_new_feature[/shell]

After finishing work and running successfully any cukes/specs/tests, commit

[shell light=”1″]git commit -am "Implemented my new super duper feature"[/shell]

Then, switch back to local master and pull if you need to also merge any changes since you first pulled

[shell light=”1″]
git checkout master
git pull origin master
[/shell]

Merge the local feature branch to master and run any cukes/specs/tests and if everything passes push changes

[shell light=”1″]
git merge my_new_feature
git push origin master
[/shell]

This is my preference: I delete the temporary local branch when everything is merged and pushed

[shell light=”1″]git branch -d my_new_feature[/shell]

Update – Here is a more sophisticated approach: Agile git and the story branch pattern

2 thoughts on “A typical workflow for a team using Git

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s