git pull, unless you're the sole owner and user of the repository.
git pull works by doing a
git fetch followed by a
git merge. This is OK if your local branch is in sync with the remote branch. Otherwise, the
git merge will result in a commit graph that looks like a spaghetti because it will do a merge of your local branch with the remote one.
A better approach is to use
git fetch followed by
Say that you're synchronising your
master branch. Do a
git fetch and
git rebase origin/master.
That will find the earliest common commit between
origin/master, move to a temporary space everything in your local branch that comes after that, fast forward it to the latest commit on
origin/master and then apply each of the commits that were put aside on top of it, one by one, stopping if conflicts are found so that you can fix them before going on with the
Confusing? It might be at first, but once you get the hang of it, you'll wonder why you've been using
git pull all this time.
More info on stackoverflow.