最常见的Mercurial命令的Git等价物? [英] Git equivalents of most common Mercurial commands?

查看:207
本文介绍了最常见的Mercurial命令的Git等价物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



什么是Git等价物:

  hg init。 #在当前目录中启动一个项目
hg addremove#查找任何添加或删除的文件
hg commit -mcomment#提交任何未改动的更改
hg status#最后一次提交?


解决方案



>在那里没有提到的两个之间还有其他一些陷阱。当我以另一种方式(git - > hg)时,这个列表是从我自己的博客文章中分拣出来的。
$ b Hg .hgignore,语法: glob与git的.gitignore一样。



Git .git / config,〜/ .gitconfig,使用git-config修改值

Hg .hg / hgrc,〜/ .hgrc,使用 hg help -c config



Git git commit -v

Hg hg diff |减; hg commit


git gitk

Hg hg视图,或来自
TortoiseHg



Git git gui

Hg Mercurial不提供GUI来选择变更集,只有控制台 hg record 命令



Hg mercurial-scm.org/wiki/RebaseExtensionrel =nofollow noreferrer> hg rebase 。对于 git rebase --interactive 这里有 hg histedit 或Mercurial队列



Git git push URL; git remote add origin URL

Hg hg push url; $ EDITOR .hg / hgrc; [路径]默认= URL



Git gitk,git log origin / master..HEAD

Hg hg传出



git git format-patch范围

Hg hg email -m filename -o



Git git add。 ;注意点 -
Hg hg add;不需要点。


git git check更新密钥 -
Hg hg update CHANGESET





为了填补空白,Mercurial提供了一些最有用的命令:



< > Hg hg记录

Git git add -p; git commit

Hg 没有真正的等价物。你只能做相当于 hg pull; hg log -r。



Hg hg out URL

Git

如果您知道如何,请添加。



对于合并冲突解决,Mercurial中的 hg resolve 命令有几个选项可以改变行为:



Hg hg resolve -m FILE(标记文件已通过手动修复冲突问题)

Git git添加文件



Hg hg resolve -u FILE 将文件标记为未解析

Git git reset HEAD FILE 取消存档


$ b Hg hg resolve -l(列出已解决/未解决冲突的文件)

Git git status - 干净地合并的文件会自动添加到索引中,那些没有冲突的文件

Hg hg解决文件(合并后,尝试重新合并文件)

Git 没有与我知道的重新合并等价的内容。


I've been using Mercurial but would like to do a quick demo of Git.

What are the Git equivalents of:

hg init . # start a project in the current directory
hg addremove # look for any added or deleted files
hg commit -m "comment" # commit any uncomitted changes
hg status # what have i changed since the last commit?

解决方案

The Git-HG rosetta stone is not bad

There are a few other gotchas between the two not mentioned there. This list was cribbed from my own blog post when I went the other way (git -> hg).

Hg .hgignore, syntax: glob is the same behaviour as git's .gitignore.

Git .git/config, ~/.gitconfig, use git-config to modify the values
Hg .hg/hgrc, ~/.hgrc, use hg help -c config

Git git commit -v
Hg hg diff | less; hg commit

Git gitk
Hg hg view, or thg from TortoiseHg

Git git gui
Hg Mercurial doesn't ship GUI to select changesets, only console hg record command.

Git git rebase
Hg hg rebase. For git rebase --interactive there's hg histedit, or Mercurial Queues

Git git push URL ; git remote add origin URL
Hg hg push URL; $EDITOR .hg/hgrc ; [paths] default = URL

Git gitk, git log origin/master..HEAD
Hg hg outgoing

Git git format-patch RANGE
Hg hg email -m filename -o

Git git add . ; Note the dot
Hg hg add ; No dot needed.

Git git checkout REVISION-KEY
Hg hg update CHANGESET


Just to fill the blanks, some of the most useful commands from Mercurial:

Hg hg record
Git git add -p; git commit

Hg hg inc [URL]
Git No real equivalent. You can only do equivalent of hg pull; hg log -r .:

Hg hg out URL
Git Please add if you know how.

For merge conflict resolution, the hg resolve command in Mercurial has a few options that change the behaviour:

Hg hg resolve -m FILE (marks the file as having been resolved by manually fixing up the conflict problem)
Git git add FILE

Hg hg resolve -u FILE marks the file as having been unresolved
Git git reset HEAD FILE to unstage the file

Hg hg resolve -l (lists files with resolved/unresolved conflicts)
Git git status - files that merged cleanly are added to the index automatically, those that are not have conflicts

Hg hg resolve FILE (after a merge, attempts to re-merge the file)
Git no equivalent for re-merging that I know of.

这篇关于最常见的Mercurial命令的Git等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆