git pull –rebase

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at:

Tried to push to git and got ref errors? A reminder to myself:

If the GitHub repo has seen new commits pushed to it, while you were working locally, I would advice for:

git pull –rebase
git push

The full syntax is:

git pull –rebase origin master
git push origin master

That way, you would replay (the –rebase part) your local commits on top of the newly updated origin/master (or origin/yourBranch: git pull origin yourBranch).

See a more complete example in the chapter 6 Pull with rebase of the Git Pocket Book.

I would recommend a:

git push -u origin master

That would establish a tracking relationship between your local master branch and its upstream branch.