[git] How can I find out what version of git I'm running?

I'm trying to follow some tutorials to learn how to use Git but some of the instructions are for specific versions.

Is there a command that I can use find out what version I have installed?

This question is related to git

The answer is


In a command prompt:

$ git --version

If you're using the command-line tools, running git --version should give you the version number.


which git &> /dev/null || { echo >&2 "I require git but it's not installed.  Aborting."; exit 1; }
echo "Git is installed."

That will echo "Git is installed" if it is, otherwise, it'll echo an error message. You can use this for scripts that use git

It's also customizable, so you can change "which git" to "which java" or something, and change the error message.


Or even just

git version

Results in something like

git version 1.8.3.msysgit.0