将两次提交之间的整个 git diff 保存在一个文本文件中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19067896/
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
Saving the entire git diff between two commits in a text file
提问by Palak Arora
is there a way where I could save the entire difference between two diff in a text file?
有没有办法可以在文本文件中保存两个差异之间的全部差异?
Suppose I wanted all the changes between A1
and A10
on master
branch.
假设我想要分支之间A1
和分支A10
上的所有更改master
。
--A11-A10-A9-A8-A7-A6-A5-A4-A3-A2-A1-master
Or, is there a way where I could get the entire diff in Terminal which I could copy+paste?
或者,有没有办法让我可以在终端中获得整个差异,我可以复制+粘贴?
回答by Brian Campbell
Sure:
当然:
git diff A10..A1 > my.diff
回答by Lolito
git diff {commit1} {commit2} > diff.txt
Being {commit1} and {commit2} a reference to the initial and finish commits you want to compare (reference could be an entire or partial SHA, a tag, HEAD.....)
作为 {commit1} 和 {commit2} 对您要比较的初始和完成提交的引用(引用可以是整个或部分 SHA、标签、HEAD .....)
回答by forvaidya
From man page..
从手册页..
git format-patch -k --stdout R1..R2
回答by Aleks Dorohovich
If you just need save diff between two recent commits, you can use this command as well:
如果您只需要保存最近两次提交之间的差异,您也可以使用此命令:
git diff HEAD^ HEAD > diff.txt
回答by bigidea
to get all folder/filenames as output from diff use
获取所有文件夹/文件名作为差异使用的输出
git diff <commit1> <commit2> --name-only