如何在Linux中为我的提交消息添加环境变量?
VERSION="1.0.0"
git commit -m "we add version " + $VERSION + " and that's it"
但这似乎不起作用。谁可以帮助我呢?
答案 0 :(得分:6)
VERSION="1.0.0"
git commit -m "we add version $VERSION and that's it"
不需要使用+
连接字符串,在双引号内保留空格。
答案 1 :(得分:2)
我犯了一个错误,就是使用-m
围绕''
消息。这将导致邮件只是“$YOUR_VAR
”而不是内容。相反,请使用""
例如:
git commit -m '$YOUR_VAR' # INCORRECT
git commit -m "$YOUR_VAR" # CORRECT