I am trying to make an alias for my GIT that looks something like that:
[alias]
send = !git add . && git commit -m "AUTOCOMMIT: $(date)" && git push
This alias is for minor modifications that do not need any message. The problem is that whenever I run git send
it returns the following:
$ git send
error: pathspec 'Fri' did not match any file(s) known to git.
error: pathspec 'Aug' did not match any file(s) known to git.
error: pathspec '22' did not match any file(s) known to git.
error: pathspec '11:31:18' did not match any file(s) known to git.
error: pathspec 'PDT' did not match any file(s) known to git.
error: pathspec '2014' did not match any file(s) known to git.
If I run the command manually there is no error:
$ git add .
$ git commit -m "AUTOCOMMIT: $(date)"
[master] AUTOCOMMIT: Fri Aug 22 11:37:17 PDT 2014
1 file changed, 1 deletion(-)
$ git push
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 368 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To <gitRepo>.git
master -> master
Any ideas?
As per git-config(1)
, under CONFIGURATION FILE: Syntax:
String values may be entirely or partially enclosed in double quotes. You need to enclose variable values in double quotes if you want to preserve leading or trailing whitespace, or if the variable value contains comment characters (i.e. it contains
#
or;
). Double quote"
and backslash\
characters in variable values must be escaped: use\"
for"
and\\
for\
.
You don’t strictly have to add a second set of quotes, so:
[alias]
send = !git add . && git commit -m \"AUTOCOMMIT: $(date)\" && git push
Also, if you save your aliases using git config
, you can avoid having to do the escaping manually:
$ git config --global \
alias.send '!git add . && git commit -m "AUTOCOMMIT: $(date)" && git push'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With