Working @GitHub Support, programming for fun, working remotely, love cooking and food, and want to learn how to play the guitar.
Published on 2009-08-27
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
git pull origin master
Create a new local branch for keeping your changes way from your local master branch
git branch my_new_feature
Switch to that branch and start working
git checkout my_new_feature
After finishing work and running successfully any cukes/specs/tests, commit
git commit -am "Implemented my new super duper feature"
Then, switch back to local master and pull if you need to also merge any changes since you first pulled
git checkout master git pull origin master
Merge the local feature branch to master and run any cukes/specs/tests and if everything passes push changes
git merge my_new_feature git push origin master
This is my preference: I delete the temporary local branch when everything is merged and pushed
git branch -d my_new_feature
Update - Here is a more sophisticated approach: Agile git and the story branch pattern