从 SourceTree 创建文件的 git diff

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22297284/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:49:15  来源:igfitidea点击:

Create a git diff of a file from SourceTree

gitatlassian-sourcetree

提问by Lakshmanaprabhu

How to create a patch file from a Source TreeActually, i need to create a patch file of a specific modified file. i can view this using External diff or git diff filename in git bash.

如何从源树创建补丁文件 实际上,我需要创建一个特定修改文件的补丁文件。我可以在 git bash 中使用 External diff 或 git diff 文件名查看这个。

回答by LoicAG

Assuming that this question is about the Git client SourceTree, here's how to create a patch file:

假设这个问题是关于Git客户端SourceTree的,下面是创建补丁文件的方法:

  1. in the Log/History view, right-click on a commit
  2. select the context menu option "Create Patch..."
  3. in the "Create Patch" dialog window, select the commits to include in the patch, choose the location of your patch file on the filesystem, and click "Create Patch".
  1. 在日志/历史视图中,右键单击提交
  2. 选择上下文菜单选项“创建补丁...”
  3. 在“创建补丁”对话框窗口中,选择要包含在补丁中的提交,选择您的补丁文件在文件系统上的位置,然后单击“创建补丁”。

回答by Tung Fam

In case you want to make a Patchfrom not committedchanges (in other words from Patch from Working Copy):

如果您想根据未提交的更改制作补丁(换句话说,来自工作副本的补丁):

  1. Choose your Uncommitted changesline List item
  2. Go to Actions
  3. Create Patch

    enter image description here

  4. Choose the "Working Copy" Tab
  1. 选择您未提交的更改项目清单
  2. 转到操作
  3. 创建补丁

    在此处输入图片说明

  4. 选择“工作副本”选项卡

回答by Serban Constantin

git diff commitid1 commitid2 > patch.diff

git diff commitid1 commitid2 > patch.diff