Mercurial入门-basic

公司目前的版本管理工具是cvs,但准备逐渐引入Mercurial,未来不再支持cvs,所以大家都开始学习Mercurial,今天上网看了看,在这里做点记录,为己也为大家。

1. Add a new folder in which you want to work.
$ hg init project

2. Add files and track them
$ cd project
$ (add files)
$ hg add /* add all files*/
$ hg add file0 file1 /* add specific files */
$ hg commit /* same as hg ci */

3. Save changes
$ (do some changes)
$ hg status /* see which files changed, which have been added or removed. */
$ hg diff /* see the exact changes */
$ hg commit
or$ hg commit -m "MESSAGE"

4. Move and copy files
$ hg cp src.c dest.c
$ hg commit
$ hg mv src.c dest.c
$ hg commit

5. Check the history
$ hg log

6. Seeing an earlier revision
$ hg update 1.3 /* revision number*/ /* or hg up 1.3*/
/* after this command, the code is back at revision 1.3 */

/*check if you are really at that revision */
$ hg identify -n

/*To update to the most recent revision. */
$ hg update tip

7. Fixing errors in earlier revisions
/* let's assume that the bug was introduced in revision 1.3 */
$ hg update 1.3
$ (fix the bug)
$ hg commit

/* Then merge to the current version */
$ hg merge

/* when there are conflicts */
/* first list the files with conflicts */
$ hg resolve --list
$ hg resolve conflicting_file /* fix it by hand, if nescessary */
$ hg commit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值