我正在配置 TeamCity 服务器,我需要知道如何识别单次推送中提交的所有文件。
例如:
- 用户提交 1:
- 文件1.c
- 文件2.c
- 用户提交2:
- 文件1.c
- 文件X.c
- 文件Y.c
我需要对所有这些文件进行分组,以便为这个“push”命令构建 1 个版本。有一个 git 命令可以做到这一点吗?
谢谢。
最佳答案
您可以显示 git 日志并使用结果:
列出最后一次提交:
git log --name-status -p -1
result:
commit d1bc9d55024e4e3e6acc087ba223bd7951b555fa
Author: unknown <johndoe>
Date: Wed Oct 7 16:20:27 2015 -0300
task1000 commit message here...
M file1.c
M file2.c
现在,列出消息中带有“task1000”的所有提交:
git log --name-status --grep="task1000"
result:
commit d1bc9d55024e4e3e6acc087ba223bd7951b555fa
Author: unknown <johndoe>
Date: Wed Oct 7 16:20:27 2015 -0300
task1000 commit message here...
M file1.c
M file2.c
commit 998a74eaa752f6c98c32ec9a412b219afb7cc891
Author: unknown <johndoe>
Date: Wed Oct 7 16:19:56 2015 -0300
task1000 more one commit for this task..
M file1.c
M fileX.c
M fileY.c
现在您必须处理这个结果。
您需要监视服务器中的每个提交。
关于git - 识别推送中所做的所有提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32997818/