Git Tutorial: Get Update from Remote Repository: git pull

, , …,

continued from git Tutorial.

How to get update from a remote repository?

use git pull URL. Example:

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

git pull https://github.com/xahlee/xah_emacs_init.git # pull from a remote repository

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

How to get update from a remote repository, and ignore all local changes?

here's one way.

git fetch --all     # get latest from remote but without merging into local
git reset --hard origin/master  # rid of all local state

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›
blog comments powered by Disqus