Use hg to sync my project between my two computers

I have two computers: a desktop in my company and a laptop in my house.

Now I want to use hg to synchronize the project between them using a "USB removable disk".

So wondering how to implement it?

On my desktop there is: D: \ work \ mypro.

I use the following command to initialize it:

hg init 

Then I connect to the USB drive with the volume label "H" and get a clone using:

 cd H: hg init hg clone D:\work\mypro mypro-usb 

ANd in my laptop I use:

 cd D: hg clone H:\mypro-usb mypro-home 

However, I do not know how to do this, if I modify some files (delete or add and change) in mypro-home, how to make mypro-usb synchronization, I also want mypro to synchronize on my desktop.

How to do it?

--------------- After receiving a response from richj, the following is added: ----------------

in richj:

Thanks for your reply.

The following is my practice: Pro-Com is a project (initialized as a repository) on my desktop, Pro-USB is a repository on my USB device, Pro-Home is a repository on my home computer.

When I make some changes to Pro-Com, I use the following command:

 hg add hg push Pro-USB 

Then I change the directory to Pro-USB using:

 hg update hg push Pro-Home 

On my home computer, I run:

 hg update (make some edition) hg commit hg push Pro-USB 

Then the USB repository is the same as my home computer, I can click it on my desktop.

In my opinion, the operation between the repository can only be performed using "hg push" and "hg pull", other commands, such as "hg update" "hg import", work only between the working copy and its repository.

As far as I understand?

+6
mercurial
source share
1 answer

To transfer changes from your working repositories back to a USB drive:

 hg push 

To get the latest changes from your USB drive:

 hg pull hg update 

These two teams can be combined as follows:

 hg pull -u 

If you want to see which change sets are available for pushing or pulling, use:

 hg outgoing hg incoming 

respectively. Any changes you make to the local file system must be bound to the repository using:

 hg commit 

before they can be pressed or pulled.

+8
source share

All Articles