如何进行git克隆并进入创建的目录

Lao*_*jin 2 git powershell

如何一次操作git clone一个项目然后cd进入新创建的目录?

git clone http//xxx (optional folder name)
cd <created directory>
Run Code Online (Sandbox Code Playgroud)

我在 Bash 中找到了几种解决方案,例如:
A better way to do git clone

但在 PowerShell 中没有..

Ans*_*ers 5

bash将您引用的解决方案转换为 PowerShell实际上并不是很复杂:

function Invoke-GitClone($url) {
  $name = $url.Split('/')[-1].Replace('.git', '')
  & git clone $url $name | Out-Null
  Set-Location $name
}
Run Code Online (Sandbox Code Playgroud)