Pregunta

I want git commit to always do a git commit -v without typing the -v

I can't see to be able to make a bash alias as it is two words with a space :(

¿Fue útil?

Solución 2

You could add a function to ~/.bash_profile or similar

git () {
  if [[ $1 = commit ]]
  then
    command git commit -v "${@:2}"
  else
    command git "$@"
  fi
}

Otros consejos

If you're willing to type in a slightly different command (git won't let you alias git built-in commands), set up a git alias

git config --global alias.ci 'commit -v'

The drawback is you have to then git ci instead of git commit. Might be just as easy to remember the -v.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top