Repositories
Here are the commands you can use to manage repositories with Git-Tool.
Git-Tool's main purpose is managing your local development directory, ensuring that your repositories are kept organized and are available when you need them with a minimum amount of cognitive effort on your part.

Directory Structure

Git-Tool uses a directory structure very similar to GOPATH. If you're curious why we've chosen this approach, please read my blog post on the topic. If you are simply curious what that means, here's an example:
1
.
2
└── dev/
3
└── github.com/
4
├── notheotherben/
5
│ └── cv/
6
└── sierrasoftworks/
7
├── bender/
8
├── blog/
9
├── git-tool/
10
├── iridium/
11
└── vue-template/
Copied!

open

The first place you're likely to start with Git-Tool is opening a repo you want to work on. To do so, you'll use the gt open command, which allows you to launch a shell (or any other app you have defined in your config) inside that repository's directory.
Aliases take precedence over repos, which take precedence over apps. When specifying an app, it should appear before the repo/alias parameter to avoid confusion.
New applications can be configured either by making changes to your configuration, or by using the git-tool config add command to install them from the GitHub registry. For example, you can use gtconfig add apps/bash to configure bash as an available app.

Aliases

    gt open
    gt o
    gt run

Options

    -c/--create will create a new repository if one with this name doesn't exist locally.
    -R/--no-create-remote will disable the creation of a remote repository when run with -c.

Example

1
# Open a repository in your default application
2
gt o github.com/SierraSoftworks/git-tool
3
4
# Open a Visual Studio shell in the current repository
5
gt o vs
6
7
# Open a repository in VS Code
8
gt o github.com/SierraSoftworks/git-tool code
Copied!
If you are already inside a repository, you can specify only an app and it will launch in the context of the current repo, like gt o vs in the example above. This can be very useful if the command you wish to run is on the complex end of the spectrum (like launching a Visual Studio developer console).

new

There's nothing new under the sun, but sometimes we like to build it anyway. If you're starting something new and want a fresh repo for it, the gt new command is your best friend. It will create and git init your repo, setup your remote hosting provider (if supported).
Of course, this command has auto-completion support and will suggest valid namespaces for your repository to appear in (such as github.com/notheotherben/ and github.com/SierraSoftworks/), helping you quickly figure out where your repo should be created.

Aliases

    gt new
    gt n
    gt create

Options

Example

1
# Create a new repository
2
gt n github.com/notheotherben/demo
3
4
# Create (and open) a new repository
5
gt n --open github.com/notheotherben/demo
6
7
# Create a new repository but don't create it remotely
8
gt n --no-create-remote github.com/notheotherben/demo
Copied!

list

If you're trying to get a list of your repositories, Git-Tool has you covered. The gt list command will show you all of your locally cloned repositories and can be a useful tool if you need to (for example) write a script which performs a task across all of them.
If you are migrating machines and want to clone your repositories, you can dump them with gt list -q and then use gt clone to import them.

Aliases

    gt list
    gt ls
    gt ll

Options

    -q/--quiet will limit the output to only the repository's name. This output is useful for consumption by scripts.
    --full will print out a series of YAML documents, using --- document separators, which contain detailed information about each of your repositories.

Example

1
# List your repositories (and their web addresses)
2
gt ls
3
4
# List the repository names containing notheotherben
5
gt ls -q notheotherben
6
7
# Gather detailed information about sierralib repositories
8
gt ls --full github.com/SierraSoftworks/sierralib
Copied!

info

If you want to get access to some of the detailed information about a repository managed by Git-Tool, including things like the URLs associated with it or the path to the repo, you can use the gt info command.

Aliases

    gt info
    gt i

Example

1
# Get information about the current repository
2
gt i
3
4
# Get information about a specific repository
5
gt i sierrasoftworks/git-tool
Copied!
You can omit the repository name if you want to get information about your current repo.

clone

The gt clone command does everything the gt open command does, except open an application. If you're trying to quickly clone a list of repositories, such as when you're setting up your new dev-box, this is the command for you.

Example

1
# Clone a repository into the appropriate folder
2
gt clone github.com/SierraSoftworks/git-tool
Copied!

fix

Git-Tool usually takes care of setting up your git origin remote, however sometimes you want to rename projects or even entire organizations. To make your life a little bit easier, the gt fix command will update your git origin remote to reflect the current repo information shown in gt info (which is based on its filesystem path).

Options

    --all will fix any repositories which match the provided pattern.

Example

1
# Fix the git remote configuration for a single repository
2
gt fix github.com/SierraSoftworks/git-tool
3
4
# Fix the git remote configuration for a group of repositories
5
gt fix --all github.com/SierraSoftworks/
Copied!
The quickest way to update a repo's origin is to mv $REPO $NEW_REPO and then run gt fix $NEW_REPO.
Last modified 20d ago