在不克隆或创建目录的情况下获取git clone目录

在不克隆或创建目录的情况下获取git clone目录,git,directory,git-clone,Git,Directory,Git Clone,我想获取Git将创建的目录的名称 例如,这些命令将分别创建一个Hello Worlddir并克隆到其中: git clone http://github.com/octocat/Hello-World git clone https://github.com/octocat/Hello-World.git git clone https://github.com/octocat/Hello-World git clone https://github.com/octocat/Hello-Worl

我想获取Git将创建的目录的名称

例如,这些命令将分别创建一个
Hello World
dir并克隆到其中:

git clone http://github.com/octocat/Hello-World
git clone https://github.com/octocat/Hello-World.git
git clone https://github.com/octocat/Hello-World
git clone https://github.com/octocat/Hello-World.git
在创建任何目录或克隆任何文件之前,我希望获取值
Hello World
以进行处理

使用Git可以做到这一点吗

或者我是否需要手动预处理克隆URL以查找最后一个
/
之后的部分并切掉任何
.git

使用:


谢谢,也适用于我用斜杠忘记的情况:
basenamehttps://github.com/octocat/Hello-World/ .git
->
你好,世界
$ basename https://github.com/octocat/Hello-World .git
Hello-World

$ basename https://github.com/octocat/Hello-World.git .git
Hello-World