我正在寻找一个简单的git命令,它提供了一个格式良好的所有文件列表,这些文件是散列(SHA1)给出的提交的一部分,没有任何无关的信息.
我试过了:
git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
Run Code Online (Sandbox Code Playgroud)
虽然它列出了文件,但它还包含每个文件的不需要的差异信息.
是否有另一个git命令只提供我想要的列表,以便我可以避免从git show输出中解析它?
我在回购中有一堆提交.我想看到两个提交之间更改的文件列表 - 从SHA1到SHA2.
我应该使用什么命令?
是否有比做库得到SHA1s的原始列表中的所有对象的一种更好的方式ls .git/objects/??/\*和cat .git/objects/pack/*.idx | git show-index?
我知道,git rev-list --all但只列出.git/refs引用的提交对象,我正在寻找包括由git-hash-object,git-mktree等创建的未引用对象的所有内容.
显然这个:
git log --all --after="<date> 00:00" --before="<date> 23:59" --author="<author>"
Run Code Online (Sandbox Code Playgroud)
过滤器根据提交者日期提交.如何让它显示指定作者日期范围的提交?
如何命令git log -p,git show以及git diff相关的,为什么会被一个比另一个使用?
鉴于有以下4个提交的回购:
commitd - last commit
commitc
commitb
coomita - initial commit
以下git命令之间有什么区别?:
git log -p commitb commitd
git show commitb commitd
git diff commitb commitd
git log -p commitd commitb
git show commitd commitb
git diff commitd commitb
git log -p commitb..commitd
git show commitb..commitd
git diff commitb..commitd
git log -p commitd..commitb
git show commitd..commitb
git diff commitd..commitb
git log -p commitb...commitd
git show commitb...commitd
git diff commitb...commitd
git …Run Code Online (Sandbox Code Playgroud) 最近我一直在使用git show <hash>创建差异供以后参考,因为它比键入更容易,git diff <hash>~ <hash>并且它显示了提交信息(时间戳,用户,哈希,注释).然后,您可以使用git apply <filename>该补丁.
我发现git show -3将显示最后三次提交以及相同的额外信息.但是,git apply将它作为非分段更改压缩到工作目录中,并丢失所有提交信息.
git中是否有适用所有信息的内容?传递一个标志而不是将补丁分成三个文件,分别应用它们,并创建新的提交,会简单得多.
我认为他们应该基本相同,但是当我尝试时
$ git stash show -p stash@{N}
Run Code Online (Sandbox Code Playgroud)
和
$ git show stash@{N}
Run Code Online (Sandbox Code Playgroud)
后者显示了一些额外的提交信息,但实际的差异要短得多.(前者显示了大约十二个文件,但后者只有一个.)
那么,两者之间究竟有什么区别,为什么它们不同?
我还可以依赖于git diff stash@{M} stash@{N}正确的事情吗?
我的遥控器上有一个裸存储库.我想查看在编辑器中打开并查看代码的文件.对于列出文件,git ls-files master或git ls-tree master.并且为了查看单个文件,我可以做git show 100644但是如何查看目录中的文件.这是一个例子:
100644 blob 03ec70a7ab513de8d568450dd8fca93987a22da0 .gitignore
100644 blob 75a85b0137fe1ee0c60bda6dcfac78d2d59a1759 README.md
040000 tree 53a58d85bc833575fdfee86058d88a4928c6fe76 templates
Run Code Online (Sandbox Code Playgroud)
如果我做git show 03ec70,它会显示.gitignore文件的内容
如果我做git show 53a58d,它会列出模板文件夹的内容
403.html
404.html
500.html
base.html
Run Code Online (Sandbox Code Playgroud)
但是如何打开单个文件才能看到它们.示例:上述情况中的base.html
我们重命名了一个文件,其中git log --follow my/new-file正确显示重命名前后的更改。
但此命令无法显示先前版本:git show <rev>:my/new-file。
我们必须跑git show <rev>:my/old-file。
有没有办法可以使用 my/ new -file 而不是 my/ old -file 运行此命令?
如果我git show在git repo中单独使用所有内容,则会显示一堆信息,例如commits,diffs等。
此页面(https://git-scm.com/docs/git-show)只是说:
Shows one or more objects (blobs, trees, tags and commits).
我认为这是最新的提交。还有一些差异(在文档页面中未提及)。
但是到底显示了什么呢?
这是完整的,相当难以理解的输出...
$ git show
commit <sha1 A> (HEAD -> A)
Merge: <sha1 B> <sha1 C>
Author: Snowcrash <my@email>
Date: Sat Jul 14 14:56:02 2018 -0700
with both files
diff --cc 1
index <sha1 D>,<sha1 E>..<sha1 F>
--- a/1
+++ b/1
@@@ -1,5 -1,6 +1,12 @@@
1
++<<<<<<< HEAD
+A
+B
+C
++=======
+ C
+ D
+ E
+
++>>>>>>> …Run Code Online (Sandbox Code Playgroud)