TortoiseHG-如何在不先提交的情况下导出单个文件的补丁? [英] TortoiseHG - How to export patch for a single file without committing first?
问题描述
如何导出 单个文件 而无需先提交(工作目录)的补丁?
How to export patch for a single file without committing first(working directory)?
这是可能的重复,但我的问题是有点不同,这个问题并不能完全给我解决我的问题的方法.另外,如果我复制补丁,以后如何使用?另外,它只能通过提交来完成,是的,这是本地提交,我以后可以还原它,但是有更简单的方法吗?
this is a possible duplicate, but my question is a little different and that question does not exactly give me a solution for my problem. Also, If I copy a patch how can I use it later? Plus it can be done with a commit only, yes it's a local commit and I can revert it later but is there a easier way?
推荐答案
hg diff -g filename >patch
将生成补丁.该文件可以处于已修改或已添加状态,但不能处于未跟踪状态. -g
是"git"格式,并且可以根据需要处理二进制文件.
hg diff -g filename >patch
will generate the patch. The file can be in the modified or added state, but not untracked. -g
is "git" format, and can handle binary files, if needed.
hg import --no-commit patch
会将其导入到工作目录.除非您还使用-f
强制应用该补丁,否则不能有其他未提交的文件.
hg import --no-commit patch
will import it to the working directory. There can't be other uncommitted files unless you also use -f
to force that patch to apply.
在TortoiseHg中,要导出工作目录中一个文件的补丁:
In TortoiseHg, to export patch for one file in working directory:
- 选择提交窗口和工作目录.
- 右键单击要为其创建补丁的文件.
- 选择
Copy patch
. - 打开记事本或类似的编辑器.
- 粘贴.
- 将文件保存在所需位置.
- Select the commit Window and the working directory.
- Right-click the file you want to create a patch for.
- Select
Copy patch
. - Open Notepad or similar editor.
- Paste.
- Save the file where you want.
要将修补程序导入回工作目录.
To import that patch back to the working directory.
- 确保没有未提交的文件.如果您不想提交,请上架.
- 选择存储库菜单,导入补丁...
- 浏览补丁.
- 选择补丁将被导入到...工作目录中"
- 点击导入.
- 如有需要,请搁置.
OR
- CTRL-L在TortoiseHg中打开控制台.
- 使用上面的
hg diff
和hg import
命令.更容易:)
- CTRL-L to open a console in TortoiseHg.
- Use the
hg diff
andhg import
commands above. It's easier :)
这篇关于TortoiseHG-如何在不先提交的情况下导出单个文件的补丁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!