1

I'm trying to write a gradle script that references the local git repository on all the user (development) machines. I have it working with my hardcoded local directory name. However, all the developers put their local repositories in a place of their own liking - this often varies between the Windows and Mac developers too!

Since I am in Groovy in the gradle script it would be simple for me to execute a local git command to get the directory where the local repository is stored. Is there such an command?

JoeG
  • 7,191
  • 10
  • 60
  • 105

1 Answers1

4

You can use git rev-parse --show-toplevel.

knittl
  • 246,190
  • 53
  • 318
  • 364
  • TOTALLY sweet! Thank you - I looked quite a bit before posting and could not easily find this anywhere. I can accept your answer in five more minutes - so you were fast too! – JoeG Sep 16 '13 at 20:00