使用 hg 在两台计算机之间同步我的项目
我有两台电脑:公司的台式机和家里的便携式电脑。
现在我想使用 hg 使用“USB 可移动磁盘”来同步它们之间的项目。
所以我想知道如何实现它?
我桌面上的 pro 是:D:\work\mypro。
我使用以下命令来初始化它:
hg init
然后我连接到卷标为“H”的USB磁盘,并使用以下命令进行克隆:
cd H:
hg init
hg clone D:\work\mypro mypro-usb
在我的便携式计算机中我使用:
cd D:
hg clone H:\mypro-usb mypro-home
但是我不知道如果修改一些内容该怎么办mypro-home中的文件(删除或添加和修改),如何使mypro-usb同步更改,我也希望mypro在我的桌面上同步。
怎么做呢?
---------------得到richj----------------的答复后添加以下内容
:
感谢您的回复。
以下是我的做法: Pro-Com 是我桌面上的项目(初始化为存储库),Pro-USB 是我 USB 中的存储库,Pro-Home 是我家用电脑中的存储库。
当我在 Pro-Com 中进行一些更改时,我使用以下命令:
hg add
hg push Pro-USB
然后我将目录更改为 Pro-USB,使用:
hg update
hg push Pro-Home
在我的家庭计算机中我运行:
hg update
(make some edition)
hg commit
hg push Pro-USB
然后 USB 中的存储库与我家的存储库相同电脑,我可以将其推送到桌面。
在我看来,存储库之间的操作只需通过“hg push”和“hg pull”即可完成,其他命令如“hg update”“hg import”仅在工作副本与其存储库之间工作。
我的理解对吗?
I have two computer : the desktop in my company and the portable computer in my home.
Now I want to use the hg to synchronize the project between them using a "USB removable disk".
So I wonder how to implement it?
THe pro in my desktop is : D:\work\mypro.
I use the following command to init it:
hg init
Then I connect to the USB disk whose volume label is "H",and get a clone using:
cd H:
hg init
hg clone D:\work\mypro mypro-usb
ANd in my portable computer I use:
cd D:
hg clone H:\mypro-usb mypro-home
However I do not know how to do if I modify some files(remove or add and modify) in the mypro-home,how to make the mypro-usb changed synchronizely,also I want the mypro in my desktop synchronizely.
How to do it?
---------------The following is added after I get an answer from richj----------------
to richj:
Thanks for your reply.
The following is my practice: Pro-Com is the project(initialized as a repository) in my desktop, Pro-USB is the repository in my USB, the Pro-Home is the repository in my home computer.
When I make some change in the 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
In my home computer I run:
hg update
(make some edition)
hg commit
hg push Pro-USB
Then the repository in the USB is the same as that of my home computer,I can push it to my desktop.
In my opinion,operation between repository can be done just by "hg push" and "hg pull",the other commands like "hg update" "hg import" just work between a working-copy and its repository.
Is my understanding right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要将更改从工作存储库推送回 USB 驱动器:
要从 USB 驱动器获取最新更改:
这两个命令可以像这样组合在一起:
如果您想查看哪些更改集可推送或拉取,请使用:
分别。您对本地文件系统所做的任何更改都必须使用以下方式提交到存储库:
然后才能推送或拉取。
To push changes from your working repositories back to your USB drive:
To get the latest changes from your USB drive:
These two commands can be combined together like this:
If you want to see which change sets are available to be pushed or pulled use:
respectively. Any changes that you make to your local file system must be committed to the repository using:
before they can be pushed or pulled.