When you are working in some Git directory, how can you get the Git repository name in some Git repository? Are there any Git commands?
# I did check out bar
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.
git rev-parse --show-toplevel
basename