I've currently got a zsh alias which runs a function which you can see here:
function gac () {
git add .; git commit -m "commit"
}
alias gac="gac"
this works fine and is somewhat useful however having a commit message of "commit" isn't useable for anything more than small personal projects.
how would i create a prompt in this function that asks for user input and then uses that user input as the commit message?
thanks!
You can simply change the function to use an argument:
gac () {
git add .
git commit -m "$1"
}
Then use it as
gac "This is my message"
Or, you can just omit -m
altogether and let your user enter a proper commit message in their text editor as usual.
gac () {
git add .
git commit
}