如何做一个git克隆并进入创建的目录 [英] How to do a git clone and enter the created directory
本文介绍了如何做一个git克隆并进入创建的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何先执行一个操作,先git clone
一个项目,然后cd
到新创建的目录中?
How to git clone
a project and then cd
into the newly created directory in one action?
git clone http//xxx (optional folder name)
cd <created directory>
我在Bash中找到了几种解决方案,例如:
做git克隆的更好方法
I found several solutions in Bash, like this one:
A better way to do git clone
但是在PowerShell中没有..
But none in PowerShell..
推荐答案
将引用的bash
解决方案转换为PowerShell确实不是很复杂:
It really isn't very complicated to turn your referenced bash
solution into PowerShell:
function Invoke-GitClone($url) {
$name = $url.Split('/')[-1].Replace('.git', '')
& git clone $url $name | Out-Null
Set-Location $name
}
这篇关于如何做一个git克隆并进入创建的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文