Issue
If I wanted to make a directory and change directory into it all in one line, I could do something like this:
mkdir dir_name && cd $_
How can I do the same with git clone
?
The command, git clone repo_url && cd $_
, won't work obviously, because there's no such directory as repo_url
. But is it possible to do it in one line?
Solution
If you want to find the name automatically you could try something like that:
git clone http://repo_url.git && cd "$(basename "$_" .git)"
That way you don't have to specify a folder name to git
.
Answered By - NullDev Answer Checked By - Candace Johnson (WPSolving Volunteer)