How do you get the Git repository’s name in some Git repository?

Well, if, for the repository name you mean the Git root directory name (the one that contains the .git directory) you can run this:

basename `git rev-parse --show-toplevel`

The git rev-parse --show-toplevel part gives you the path to that directory and basename strips the first part of the path.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)