src script

A convenience script to for rapidly switching context between different git repositories.


Assuming /usr/local/bin is in your PATH, you can install it by running:

curl --create-dirs -o "/usr/local/bin/src" && chmod +x "/usr/local/bin/src"

Usage Examples

Clone if needed and print the directory where it was cloned. (If it’s already cloned just print the directory.)

$ src

Clone if needed and cd into the directory:

$ cd "$(src"

Clone if needed and open a new tmux pane in the clone directory. (Only works if running inside tmux of course.):

$ src -t

Because there is a default host set to, you can also just use samsalisbury/home in place of in the examples above.

Because there is a default username, mine currently set to hashicorp you can also omit the username for cloning repos from that user, e.g.: src -t vault is equivalent to src -t hashicorp/vault is equivalent to src -t

See the source code at

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: