3

Possible Duplicate:
Is there a way to get to the git root directory in one command?

how can i check what git repository am I using ?

I can see the result with 'git init'.

git init returns 'Reinitialized existing Git repository in c:/Users/k-9/.git/'

but I think git init is not a proper command.

Community
  • 1
  • 1
Sungguk Lim
  • 6,109
  • 7
  • 43
  • 63

1 Answers1

4

git rev-parse --show-toplevel will show the top-level directory of the repository if your working directory is a git repository.

$ git rev-parse --show-toplevel
fatal: Not a git repository (or any of the parent directories): .git
$ cd gitrepo
$ git rev-parse --show-toplevel
/home/jamessan/gitrepo
jamessan
  • 41,569
  • 8
  • 85
  • 85