Git Tutorial: Get Update from Remote Repository: git pull

By Xah Lee. Date: . Last updated: .

continued from git Tutorial.

How to get update from a remote repository?

use git pull URL. Example:

# cd to my git project dir
cd ~/git/xah_emacs_init

# pull from a remote repository
git pull

This will update your local repository (and working dir) from remote server.

How to force a pull?

# get latest from remote but without merging into local
git fetch --all

# rid of all local state
git reset --hard origin/master

here's another way.

# discard local changes
git reset --hard

# delete all untracked local files and dirs. (DANGEROUS)
git clean -xdf

git pull remote_server_or_name