Skip to content

How to write a function to clone & then cd into the local repository? #8975

Closed Answered by faho
Jarmos-san asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by faho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants