添加env var以提交消息

Den*_*boy 0 git bash commit

如何在Linux中为我的提交消息添加环境变量?

VERSION="1.0.0"

git commit -m "we add version " + $VERSION + " and that's it"
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用.有谁可以帮我吗?

P..*_*... 7

VERSION="1.0.0"
git commit -m "we add version $VERSION and that's it"
Run Code Online (Sandbox Code Playgroud)

无需连接字符串+,在双引号内保留空格.


Ser*_*rov 5

我犯的一个错误是-m''. 这将导致消息只是“ $YOUR_VAR”而不是内容。相反,使用""

前任:

  git commit -m '$YOUR_VAR' # INCORRECT
  git commit -m "$YOUR_VAR" # CORRECT
Run Code Online (Sandbox Code Playgroud)