0

On my course, very often we git clone and then cd into the folder we just made. We've got hundreds of repositories and so it would have saved/ continue to save a lot of time. Especially when the things we are cloning have similar names.

I have tried googling the problem and tried appending some things onto the git clone 'repo here' line.

For example i'm in a folder called week 4, what I currently do is copy a repo lets say 'advanced-JS', then gcl advanced-JS, then cd advanced-JS. But what id like to do it type gcl advanced-JS (x), for it to clone it onto my computer and cd into the folder it just made. x being the unknown here.

Thank you.

Daniel Mann
  • 53,152
  • 13
  • 97
  • 112

1 Answers1

2

As has been described here (and similar places):

you can create a shell function:

gclonecd() {
   git clone "$1" && cd "$(basename "$1" .git)"
}
tkruse
  • 9,503
  • 5
  • 47
  • 73