I am trying to write a command which commit's to the origin master for github, and on completion of that, shut's down the computer... Here is what I have, and it is pointing out a lot of syntax errors as I cannot find out how to have a multiline alias command... Thanks a lot and below is my function, apologies if this is a basic mistake as I am relatively new to the ZSH shell.
# Push to origin master and shut down
alias gitshut=
'
git add .;
git commit -m "Latest Commit";
git push -f origin master;
'
Thanks again, and i appreciate your help
Don't bother with an alias at all. Define a function.
gitshut () {
git add .
git commit -m "Latest Commit"
git push -f origin master
}
Aside from having fewer quoting issues, this allows you to pass a better commit message as an argument, e.g.,
gitshut () {
msg=${1:-Latest Commit}
git add .
git commit -m "$msg"
git push -f origin master
}
Now you can use gitshut to use the default Latest Commit message, or gitshut "Fixed overflow bug" to provide something that actually describes what is being committed.
Your alias does not address the shutdown part, but you could rewrite it with:
alias gitshut='git add .;git commit -m "Latest Commit";git push -f origin master;'
Or possibly as:
alias gitshut='\
git add .;\
git commit -m "Latest Commit";\
git push -f origin master;'
Using a function as in here might be easier.
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