Git: git pull (Get Update)

By Xah Lee. Date: . Last updated: .

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

How to force clean pull from a original project by url?

suppose this is the original project:

you forked from it.

now you want a clean sync. That is, you want a fresh clone of melpa.

git remote add upstream
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force

If you have a question, put $5 at patreon and message me.


  1. Install git
  2. Git Basics
  3. Git Ignore File
  4. Commit Files
  5. Push to Server
  6. Pull from Server
  7. Find Difference
  8. View Log
  9. Revert Change
  10. Branching
  11. Temp Save: git stash
  12. What's HEAD
  13. FAQ