Start with your master branch

git checkout master
git fetch origin

If your local master has been modified, you can reset its state.

git reset --hard origin/master

Checkout a new feature branch.

git checkout -b my-feature

Make changes in this branch, committing as usual.

git add file.txt
git commit -m "add my file.txt"

You can push your branch to allow others and yourself to evaluate and commit further to it.

git push -u origin my-feature

It’s time to test, review, get approval, etc. for your branch to be merged into master!

Now we merge my-feature into master:

git checkout master
git pull
git pull origin my-feature
git push

Here we checkout master, making sure to be at the latest revision with git pull. Next you pull in the changes from the my-feature branch, git pull is shorthand for running git fetch followed by git merge. So if there aren’t any conflicts, your master should now include the commits from my-feature.

Finally you git push your updated local master to your origin.