【发布时间】:2020-06-02 06:28:36
【问题描述】:
我已经看到this 的回答,这几乎正是我所需要的。
不同之处在于它会为人眼打印日期,而我需要在 Makefile 中检查它。
特别是我需要重建某个文件 IFF 在它创建后在 repo 中发生了一些变化。
我可能没有 repo 的本地副本,所以我可能需要一个完整的“git clone”(可能很浅),但我不能直接使用文件日期,因为 git 不保留它们。
我需要类似的东西:
if myfile is_older $(git log -1 --format=%cd origin/master); then ... 或Makefile:
myfile: $(somefunc $(shell git log -1 --format=%cd origin/master))
commands to rebuild myfile
但我不知道怎么写。
【问题讨论】: