从Makefile中进行Git提交


8

我正在处理的Latex项目有一个Makefile。Makefile不是我的强项,但是有一种方法可以执行以下操作:

make git "My comment"

并让makefile执行:

git commit -m "My comment"
git push origin master

Answers:


9

您可以使用变量并从Makefile中读取它。例:

git:
    git commit -m "$m"

然后,您可以提交:make git m="My comment"


5

你可以这样称呼它

make git-"My comment"

并为以下内容写一个模式规则git-%

git-%: 
        git commit -m "$(@:git-%=%)"
        git push origin master
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.