Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between update and pull?

Can someone clarify what's the exact difference between update and pull commands?

Thanks.

like image 838
emurad Avatar asked Dec 09 '10 02:12

emurad


People also ask

What does hg pull do?

Description. Pull changes from a remote repository to a local one. This finds all changes from the repository at the specified path or URL and adds them to a local repository (the current one unless -R is specified).

What is hg update?

hg update --clean. Cancel an uncommitted merge and lose changes. hg revert. Undo all uncommitted changes.


1 Answers

hg update : http://www.selenic.com/mercurial/hg.1.html#update

  • Update the repository's working directory (the "working copy") to the specified revision of the repository

hg pull : http://www.selenic.com/mercurial/hg.1.html#pull

  • Allows you to bring changes from a remote repository

So when you do an hg pull, you bring changes to your repository which is under .hg. It will not reflect in your working directory.

After that, when you do a hg update, the changes are brought to your working copy.

Your repo                                 Remote Repo  \                                        \   |                hg pull                 |   |-.hg  <-------------------------------- |-.hg   |   |  --------------------------------> |   |  hg update       hg push               |   |   |                                    |   |- working folder                        |- working folder 

This is very usual confusion when coming from subversion like version control systems.

In subversion : svn update bring the changes from central repo server to your working copy

But in DVCSs , you have both a local repository and working copy. So update does exactly the same but pulls the changes from your local repo to local working copy.

like image 115
pyfunc Avatar answered Sep 18 '22 14:09

pyfunc