TortoiseHG-如何在不先提交的情况下导出单个文件的补丁? [英] TortoiseHG - How to export patch for a single file without committing first?

查看:103
本文介绍了TortoiseHG-如何在不先提交的情况下导出单个文件的补丁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何导出 单个文件 而无需先提交(工作目录)的补丁?

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:

  1. 选择提交窗口和工作目录.
  2. 右键单击要为其创建补丁的文件.
  3. 选择Copy patch.
  4. 打开记事本或类似的编辑器.
  5. 粘贴.
  6. 将文件保存在所需位置.
  1. Select the commit Window and the working directory.
  2. Right-click the file you want to create a patch for.
  3. Select Copy patch.
  4. Open Notepad or similar editor.
  5. Paste.
  6. Save the file where you want.

要将修补程序导入回工作目录.

To import that patch back to the working directory.

  1. 确保没有未提交的文件.如果您不想提交,请上架.
  2. 选择存储库菜单,导入补丁...
  3. 浏览补丁.
  4. 选择补丁将被导入到...工作目录中"
  5. 点击导入.
  6. 如有需要,请搁置.

OR

  1. CTRL-L在TortoiseHg中打开控制台.
  2. 使用上面的hg diffhg import命令.更容易:)
  1. CTRL-L to open a console in TortoiseHg.
  2. Use the hg diff and hg import commands above. It's easier :)

这篇关于TortoiseHG-如何在不先提交的情况下导出单个文件的补丁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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