I am using a .bat file to commit a project to git and github. I would like it to take one optional argument that is the username of the person calling the file. That will be passed in using the command line. Don't worry about that part, it works fine. The part that is not working is the git commit -m "%comment%"
line. The ECHO %comment%
line prints out what I would expect it to print, but then it's not being passed to the git comment. The text %comment%
is the comment being passed in instead of Saved on Mon 10/11/2021-21:45:34.59 by makpo
. What am I doing wrong?
@ECHO OFF
SET comment=Saved on %date%-%time%
IF "%~1"=="" GOTO COMMIT
SET username=%1
SET comment=%comment% by %username%
:COMMIT
ECHO %comment%
git checkout development
git add .
git commit -m "%comment%"
git push origin
NOTE: I also posted this on superuser, but I'm never really sure if that is the right place to ask these kinds of questions. Also, I feel like overflow has a lot more engagement.