本地提交后比较 [英] Diff after committing locally
问题描述
我刚刚从他们的遥控器克隆了一个回购协议.
I just cloned a repo from their remote.
我构建了该软件,更改了约4个文件,在本地提交了,现在想创建一个补丁来向他们展示.
I built the software, changed about 4 files, committed them locally and now want to create a patch that I can show them.
当我跑步时:
hg diff -U8p abc efg pqr > patch_file
我看不到所做的更改. hg diff
仅将当前文件与最后提交的文件进行比较吗?
I don't see the changes I made. Does hg diff
only compare the current files with the last committed files?
我如何使它工作?
推荐答案
-
要针对特定修订版
REV
对工作目录进行diff
,请使用
To
diff
the working directory against a particular revisionREV
, use
hg diff -r REV
要相互比较两个修订版本,请使用
To compare two revisions against each other, use
hg diff -r REV1 -r REV2
要找出要比较的修订,请检查 hg日志
的输出.如果您将大量执行此操作,并且基本修订版本已修复,请使用
To figure out which revisions to compare, examine the output of hg log
. If you'll be doing this a lot and the base revision is fixed, give it a name (e.g., whatipulled) with
hg tag -r REV whatipulled
然后,您可以将 whatipulled
指定为修订版本,而不是数字版本ID(或哈希).
You can then specify whatipulled
as the revision, instead of a numeric rev id (or a hash).
要以比较丰富的格式(包括提交注释等)导出差异,还可以使用以下目的:
To export your diffs in a richer format, including commit comments etc., you can also use the following which is designed for this purpose:
hg export -r REV
还有 hg bundle -r REV
,它会生成具有类似信息的二进制文件.
There's also hg bundle -r REV
, which produces a binary file with similar information.
但是,如果要将更改发送回父仓库,最好的方法是使用 hg push
.它将您的变更集直接传达给父级;您甚至不需要知道需要推动哪些变更集.当然,您必须有权推送到父存储库.
But if you're sending changes back to the parent repo, the best method is to use hg push
. It communicates your changesets directly to the parent; you don't even need to know which changesets need pushing. Of course, you must have the right to push to the parent repo.
hg push [ parent_repo_url ]
(如果您退出了,Mercurial应该已经知道路径,可以将其忽略).
(If you pulled from it, mercurial should already know the path and you can leave it out).
如果父存储库位于bitbucket上,而您没有pu,则可以在bitbucket上设置自己的帐户,从本地存储库中拉出/推送到该帐户,然后发出拉取请求"以项目回购,要求他们从您那里撤出.
If the parent repo is on bitbucket and you don't have pu, you can set up your own account on bitbucket, pull/push to that from your local repo, and then issue a "pull request" to the project repo, asking them to pull from you.
以上所有选项都有控制其行为的选项,请参见.
All of the above have options to control their behavior, which see.
这篇关于本地提交后比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!