npm package: @pwuersch/git-cli
Description: A git cli with many helpers
Author: pwuersch
Latest version: 1.1.5

# Git-CLI

This cli provides easy to use commands for creating git repos, managing credentials and committing changes. It is installable via a node package manager. It uses a configuration file which gets saved to your home folder. To use this tool there are some example usages documented in the usages section.

### GItLab / GitHub API's

The cli is capable of using GItLab and GItHub RestAPI's. This will be automatically activated if you have an access key and host defined in the profile you are using in a compatible action (e.g. `gt c` and `gt n`). The configuration dialogue will also take you through all steps needed if you want to configure an API provider for your profile.

## Commands

Here is a list of every available command:

```bash
gt new      # Creting a new git repo remotely and clone + configure it locally
gt clone    # Cloning an existing git repo
gt config   # Apply a profile's settings to the current git repo
gt generate # Generate git-lfs or .gitignore files for your current repo
gt update   # Update all .gitignore templates in the local cache
gt setting  # Configure profiles with git credentials, api tokens and GPG keys
c           # Commit all changes in a repo with a specified message and push to remote
```

### New git repo (`gt n`)

##### Aliases: `gt new`

This command is only available for use in combination with a api enabled profile. It will create a new repository on the target server and clone it to a local folder. In addition it will configure the cloned repo with the required settings and provide an option to enable git-lfs (with a template) and generate a .gitignore file.

Optional parameters:

```bash
-f <string> # Target folder for cloning the remote repository
-p <string> # Profile name or alias to use for creating and configuring the repo
```

### Clone remote repo (`gt c`)

##### Aliases: `gt clone`

This command clones an existing git repository. It can be used in combination with a configured API provider. If a url is specified via the `-u` parameter the API capabilities of the selected profile will be ignored.

```bash
-u <string> # SSH url to the existing git repo
-f <string> # Target folder for the cloned repo
-p <string> # Profile name or alias to use for configuring the cloned repo
```

### Generate gitignore / Configure git-lfs (`gt g`)

##### Aliases: `gt generate`

This command is currently able to do two different things. Creating a .gitignore file in the current directory and configuring git-lfs in the current repo in combination with a default .gitattributes template. Per invocation only one thing can be done. There are no parameters available for this command since those actions are mainly done via the interactive command line context.

### Update gitignore template cache (`gt u`)

##### Aliases `gt update`

Every time you are using a gitignore template the template will be stored in a local cache to remain useable offline. To 'prepare' even more for offline use you can also update all templates manually with this command.

### Configure cli profiles (`gt s`)

##### Aliases `gt setting`, `gt settings`

For managing your profiles there are 3 sub-commands available.

```bash
gt s add # Add a new profile
gt s ls  # List configured profiles
gt s rm  # Remove a profile
```

### Commit changes (`c`)

##### Aliases `gt commit`

The easiest way to commit all local changes and pushing them onto the remote branch.

```bash
c # No additional text will trigger the interactive message dialogue
c This is my commit message
```