Skip to content

Clones git repos with implied URL prefix to standard directory layout from anywhere.

License

Notifications You must be signed in to change notification settings

joneskoo/git-get

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-get

git-get is a helper that allows cloning relative URLs with a short hand

$ git get joneskoo/git-get

Regardless of working directory where git get is executed, this expands to:

$ git clone [email protected]:joneskoo/git-get ~/src/github.com/joneskoo/git-get

This allows easy cloning of repositories into an uniform directory structure.

Go

Installing

$ go get -u github.com/joneskoo/git-get

Make sure git-get is in your PATH; by default go get installs to $HOME/bin. git will automatically understand git get after this, but git-get is also valid.

Configuration

You can override the defaults by setting environment variables:

Environment variable Default Description
GIT_GET_PREFIX [email protected]: Prefix to add to relative clone targets
GIT_GET_ROOT ~/src Clone destination directory root

Usage

$ git get joneskoo/git-get
$ git get [email protected]:joneskoo/git-get
$ git get https://github.com/joneskoo/git-get

These all clone to same directory.

Pro tip: combine git-get with CDPATH in your shell. If you set in your .zshrc or .bashrc:

CDPATH=$HOME/src:$HOME/src/github.com:$HOME/src/github.com/joneskoo:.

You can use any of these commands to cd into /home/joneskoo/src/github.com/joneskoo/git-get from anywhere!

$ cd git-get
$ cd joneskoo/git-get
$ cd github.com/joneskoo/git-get

But not only that, you can use cd to your other favorite projects as everything is cloned to the same directory structure. As you can also clone with absolute URLs, this works fine if you use this for work repositories but occasionally clone some open source project.

WARNING: this is highly addictive and you will not be able to work without this after trying it.

About

Clones git repos with implied URL prefix to standard directory layout from anywhere.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages