I would like to create a simple bash function to use for my convenience. Following the answer given at: Joining bash arguments into single string with spaces I've been able to mash up this small piece of code:
function gcm {
msg="'$*'"
eval "git commit -m ${msg}"
}
Now, this example is very convenient for commit messages like "Hello, it's me" (simple set of word characters that is), but when I wan't a commit message like: "[WIP] Halfway trough code.", I get an error message as follows:
zsh: no matches found: [WIP]
Would you please clarify for me what is happening in the background and why this snippet fails?
$msg
, the problem gone – cuonglm Apr 04 '16 at 19:04alias gc='git commit -m "'
I just typegc
, my message and end it by typing a double quote. Unlike the function, it allows for multiline commit messages – cassepipe Jun 27 '23 at 22:06