Possible Duplicate:
Is there a way to get the git root directory in one command?
I am writing a bash script (actually a Makefile) that needs to use an argument that is a directory relative to the root of the git working directory that contains the current directory.
That is:
/home/me$ git clone /abc/foo.git
directory foo created
/home/me$ cd foo/bar
/home/me/foo/bar$ execute_script.sh
hello /home/me/foo/baz
execute_script.sh is as follows:
echo hello `git something`/baz
What is git something ? It should return the absolute path of the current git working root.