简体   繁体   English

如果存在合并,如何显示自上次提交以来已更改文件的列表?

[英]How to show a list of changed files since last commit if there was a merge?

I've been using the following command to see a list of files which changed since the previous commit, and for the most part it works. 我一直在使用以下命令来查看自上一次提交以来已更改的文件列表,并且在大多数情况下都可以使用。

git show --oneline --name-only HEAD | tail -n +2

However, consider this case. 但是,请考虑这种情况。

The repository is cloned in two places. 该存储库被克隆到两个地方。 Person A deletes a file from the repo called foo and pushes his changes up to the repo. 人员A从仓库中删除了一个名为foo的文件,并将其更改推送到仓库中。 After that person b deletes a file from the repo called bar and tries to push up his changes. 在那个人b之后,从仓库中删除了一个名为bar的文件,并尝试增加他的更改。 He is notified that he has to do a pull. 他被告知必须拉。 He does a pull and he has to merge. 他拉力,他必须合并。 After the merge, he pushes up his changes. 合并后,他推高了自己的更改。

The git show command above will not show any information about the files foo or bar. 上面的git show命令将不显示有关文件foo或bar的任何信息。 There is a similar command I can use, 我可以使用类似的命令

git show --oneline --stat | head -n -1 | tail -n +3 | awk '{print $1}'

But this will only list the file foo and not bar. 但这只会列出文件foo而不会列出bar。

What git command can I run to show that the file bar was changed? 我可以运行什么git命令来显示文件栏已更改?

git show object displays the object such as a commit. git show object显示对象,例如提交。 In the situation you explained, adding the two files and the merge happened in three separate commits. 在您说明的情况下,添加两个文件和合并是在三个单独的提交中进行的。 A simple way to see it is to use git log and use the flag n to limit the number of previous commits: 一种简单的查看方法是使用git log并使用标志n限制以前的提交次数:

git log --oneline --name-only -n 3

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

相关问题 将二进制文件与导出的文本文件进行比较,找出哪些二进制文件已更改或自上次导出以来是下一个 - Compare binary to exported textfiles and find which binary files have changed or are next since last export 如何获取存储库中在过去 6 个月内未更新/更改的文件列表 - How to get the list of files in a repository that have not been updated/changed in the last 6 months 分支合并提交后,分支中的最后提交是否有日期? - Can last commit in branch have date after branch merge commit? 如何显示自从上次在Linux中重新启动系统以来,最多运行了什么程序 - how show what program has been run the most times since the system was last rebooted in linux RPM中已更改文件的列表 - List of changed files in RPM 简单的svn提交后挂机更新目录与更改的文件 - simple svn post-commit-hook updating dir with changed files Linux-如何查找最近12个小时内未查找命令更改的文件 - Linux - How to find files changed in last 12 hours without find command 根据对列表合并文件 - Merge files based on a list of pairs 如何列出所有文件的大小和上次修改日期? - How do I list all files with their size and last modified date? 如何递归列表文件的大小和上次修改时间? - How to recursive list files with size and last modified time?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM