Git shortcut to pull with clone if no local there yet?

There is not, given that the commands which operate on existing repos all assume that they’re being run inside a given repo.

That said, if you’re running in a shell, you could simply make use of the shell built-ins. For instance, here’s bash:

if cd repo; then git pull; else git clone https://server/repo repo; fi

This checks to see if repo is a valid directory, and if so, does a pull within it; otherwise it does a clone to create the directory.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)