hg命令

时间:2023-03-08 21:02:05

hg常用命令

hg命令跟git命令大同小异

hg version 查看hg版本

hg clone url 克隆代码仓库

hg branch newBranch 创建分支

hg update otherBranch 切换到其他分支

hg update -r versionNum 切换到指定版本号

hg pull 拉取代码

hg commit 提交代码

hg push 推送代码

hg log -v 查看提交记录

hg log --debug 查看提交记录(更详细)

hg status 查看变更

hg diff 查看异同

hg revert 版本号 --all  还原更改

hg merge 合并代码

****************************************************************************************************************

hg提交代码常见问题解决
1. 合并代码过程出现`中止: outstanding uncommitted merge`提示
$ hg update --clean
$ hg merge yourBranchName
$ hg commit -m '改动内容描述'
$ hg push
2. 执行hg命令时,出现`waiting for lock on working directory of ...`
在文件目录下,找到.hg/wlock或者.hg/store/lock文件,删除后即可正常操作
3. 执行hg命令时,出现`push creates new remote head xxxxxx, merge or see 'hg help merge' for details about pushing new heads`
改问题可能是被人合并或改动了你的分支产生,所以查看是否有更改,若有hg pull, 若无,则hg push -f (强行提交)