A 使所有克隆成为git repo.我想知道提交哈希是什么,并将git commit hash分配给一个变量,该变量稍后可以在Makefile中使用
例如
all: download
echo '$(GIT_COMMIT)'
download:
cd buildarea && git clone git@github.com:proj/project.git
$(eval GIT_COMMIT = $(shell cd buildarea/project && git log -l --pretty=format:"%H"))
echo '$(GIT_COMMIT)'
Run Code Online (Sandbox Code Playgroud)
小智 5
使用shell函数和2个目标怎么样?
all: download getver
getver: VER=$(shell cd buildarea/project && git log -1 --pretty=format:"%H")
getver:
@echo GIT_COMMIT=$(VER)
download:
mkdir -p buildarea && cd buildarea && git@github.com:proj/project.git
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4542 次 |
| 最近记录: |