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

前端 未结 17 1303
囚心锁ツ
囚心锁ツ 2020-12-22 16:18

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         


        
17条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-22 16:56

    This one works pretty well with git-2.18.2 and can be launched from outside git target repository:

    basename -s .git $(git --git-dir=//.git remote get-url origin)

提交回复
热议问题