如何找到提交到 git 分支的文件列表?
如何列出我提交到特定分支的所有文件?我已经向分支提交了大约 40 多个文件,我需要找到文件名,因为我正在尝试调试某些东西,当我不记得文件名时很难做到这一点。
git log
只给我一长串提交,而不是实际的文件。
How do I list all the files that I committed to a specific branch? I've committed about 40+ files to a branch, and I need to find the file names because I am trying to debug something, hard to do when I don't remember the file names.
git log
only gives me a long list of commits but not the actual files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
你试过 git ls-tree 吗?
--name-only 只提供文件名。
-r 递归到子目录。
如果您希望在递归之前列出子目录的名称,请将 -t 添加到参数列表中。
Have you tried git ls-tree?
--name-only gives you just the file names.
-r recurses into sub directories.
If you want the name of the sub-directory listed before recursing into it, add -t to the argument list.
如果您的分支源自
master
,您可以使用此命令列出分支后添加的所有新文件:--diff-filter
的可用过滤器为:If your branch was derived from
master
you can use this command to list all new files that where added after branching:Available filter for
--diff-filter
are:git log --name-only 为我工作。
git log --name-only
worked for me.git ls-files
命令列出了所有当前分支上最新提交中存在的文件。或者,您可以使用 git diff --name-only 来显示任意两个任意提交之间不同的文件列表。
The
git ls-files
command lists all the files that exist in the latest commit on the current branch.Or, you can use
git diff --name-only
to show a list of the files that are different between any two arbitrary commits.git log --name-status
将给出每次提交中更改的文件的名称和状态git log --name-status
will give the names and status of changed files in each commit这对我有用。
This worked for me.
如果您想知道自分支以来修改的所有不同文件,这一点可能很有用:
这个变体将列出您修改过的子集:
This one can be useful, if you want to know all distinct files that got modified since branching:
And this variant will list the subset of them that you modified:
尝试使用smartgit。它是 git 的 GUI 客户端。它有非常有用的用户界面,并且免费供非商业用途。
try using smartgit. it is gui client for git. it has very useful UI and is free for non-commercial use.
将列出已添加到新分支但不在邮件中的所有文件 - 在本例中为
development
主分支。此变体将显示新分支
通用形式中的所有文件:
是的,顺序确实很重要。
will list all files that have been added to the new branch that are not in the mail - in this case
development
main branch.This variant will show all files in the new branch
Generic form:
and yes, order does matter.