How to write a function to clone
& then cd
into the local repository?
#8975
-
I'm trying to create a function to clone a On Bash, the following snippet worked great for me (source): gclone () {
git clone $1
local ldir=`ls -t | head -1`
echo $ldir
cd $ldir
pwd
} |
Beta Was this translation helpful? Give feedback.
Answered by
faho
May 26, 2022
Replies: 1 comment
-
Please look at the documentation, in particular https://fishshell.com/docs/current/fish_for_bash_users.html. In your case, this is simple enough to rewrite directly: function gclone
git clone $argv[1]
set -l ldir (ls -t | head -1)
echo $ldir
cd $ldir
pwd
end However, it would scale a lot better if you read the documentation for yourself before you asked. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
faho
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please look at the documentation, in particular https://fishshell.com/docs/current/fish_for_bash_users.html.
In your case, this is simple enough to rewrite directly:
However, it would scale a lot better if you read the documentation for yourself before you asked.