- After you've selected a feature to work on, create a branch in your local repo to build it in.
$ git checkout -b calaway/short_description_of_feature
- Implement the requested feature, make sure all tests are passing, and commit all changes in the new branch.
- Checkout the master branch locally.
$ git checkout master
- Pull down the master branch from GitHub to get the most up to date changes from others. If you practice git workflow as described here you should never have a merge conflict at this step.
$ git pull origin master
- Make sure all tests are passing on master and then checkout your new branch.
$ git checkout calaway/short_description_of_feature
- From your new branch, merge in your local master branch.
$ git merge master
- Resolve any merge conflicts, make sure all tests are passing on the new branch, and then commit all changes from the merge.
$ git add .
$ git commit -m "Merge in master."
- Push the feature branch to the remote repo.
git push --set-upstream origin calaway/short_description_of_feature
- Submit a pull request on GitHub asking to merge the branch into master.
- A teammate reviews the code for quality and functionality.
- The teammate merges the pull request and deletes your branch from GitHub.
From the Pro Git book:
Getting in the habit of creating quality commit messages makes using and collaborating with Git a lot easier. As a general rule, your messages should start with a single line that’s no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. [...] It’s also a good idea to use the imperative present tense in these messages. In other words, use commands. Instead of “I added tests for” or “Adding tests for,” use “Add tests for.”
You can do the same thing, but works different, creates copy of your commits and adds them to the end of your target and looks like a unique branch do not create additional merge branch, so be careful and don't use it when those commits are public and shared because it will create problems.