简体   繁体   English

我如何查看用户在 git 存储库中编辑过哪些文件?

[英]How do I see which files have ever been edited by a user in a git repo?

Not sure if there is a way to use git blame across all files to check file history for all files in the repo and see if your user has edited it before.不确定是否有办法在所有文件中使用 git blame 来检查存储库中所有文件的文件历史记录,并查看您的用户之前是否编辑过它。 Looking to run a report for fun to see how much of the codebase I have explored and some areas I should spend more time looking into!希望以有趣的方式运行报告,看看我探索了多少代码库以及我应该花更多时间研究的一些领域!

Running git blame across the whole repo sounds slow and may not capture the full file history.在整个存储库中运行 git blame 听起来很慢,并且可能无法捕获完整的文件历史记录。 Perhaps looking at the repo commit history and the file diff for all the commits you edited would be a better approach.也许查看回购提交历史记录和您编辑的所有提交的文件差异会是更好的方法。

You can try something like:你可以尝试这样的事情:

git log --oneline --author="<me>" --name-only

this will list files that show up as modified in commits you authored.这将列出在您编写的提交中显示为已修改的文件。

You may try --name-status or --numstats instead of --name-only ,您可以尝试--name-status--numstats而不是--name-only
you may also add -w (short for --ignore-all-space ) to overlook lines where you only changed the indentation.您还可以添加-w--ignore-all-space缩写)以忽略仅更改缩进的行。

If you want to restrict the log to files that only exist in the current commit (and avoid seeing files or directories that have been moved or delete since their creation), you may use git ls-files to have a list of files to filter:如果您想将日志限制为仅存在于当前提交中的文件(并避免看到自创建以来已移动或删除的文件或目录),您可以使用git ls-files来获取要过滤的文件列表:

git log ...  -- $(git ls-files)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何取消登台/删除远程Git存储库中已删除的文件? - How do I unstage/delete files that have been deleted in the remote Git repo? 如何查看已编辑的突出显示行 - how to see highlighted rows that have been edited 如何查看两个Git分支上分歧的文件? - How do I see files that have diverged on two Git branches? Git搜索仓库获取包含字符串的所有文件的名称 - Git search repo for the names of all files that have ever contained a string 如何在 git 中查看自某个日期以来添加到 repo 的所有文件? - How do I see all files added to a repo since a certain date in git? Git尝试提交文件重组,未编辑任何文件 - Git Trying to commit a file restructure, no files have been edited Git merge-除已编辑的文件外,所有文件 <name> , <name> , 要么 <name> ,在哪种情况下我会自己解决合并冲突? - Git merge --theirs ALL files EXCEPT the ones that have been edited by <name>, <name>, or <name>, in which case I'll fix merge conflicts myself? Git - 如何查看分支是否已合并到另一个分支? - Git - How to see if a branch has EVER been merged into another branch? 如何查看 git 添加的文件? - How do I see git added files? 如何判断哪些文件在git中被标记为“假设未更改” - How can I tell which files have been marked as “assume unchanged” in git
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM