8 releases (stable)

1.2.3 Oct 18, 2021
1.2.2 Oct 14, 2021
1.2.1 Sep 17, 2021
1.2.0 Feb 15, 2021
0.1.1 Nov 24, 2020

#2919 in Command line utilities

MIT license

22KB
504 lines

cgu

Crates.io Crates.io CI

Manage multiple git configurations

Inspired by Git-User-Switch.

Installation

# this will install the executable `cgu` and `git-change-user`
cargo install change-git-user

# enable only the cli
cargo install --no-default-features --features=cli change-git-user

# enable only prompts
cargo install --no-default-features --features=prompts change-git-user

Features

  • Switch user.name and user.email config
  • Assign an optional user.signingKey to the config
  • Give the config a name to remember it by (e.g. "Work" or "Personal")
  • Uses git2 to discover a repository and manipulate its config

Usage

NOTE You can use cgu and git change-user interchangeably.

Prompts

# This will spawn prompts to guide you through managing user configurations
cgu

CLI

If you don't want use use prompts, you can use subcommands instead. The subcommands are:

  • add
  • select
  • delete
  • view

Examples

# view CLI options
cgu --help

# view subcommand help
cgu <subcommand> --help

# Add a config with the name "My Config"
# Defaults to the user.name value ("My Name" in this example) if --name is not passed
cgu add --name "My Config" "My Name" example@email.com

# View all configs
cgu view --all

# Select the new config
cgu select "My Config"

# Delete the new config
cgu delete "My Config"

Dependencies

~13–24MB
~377K SLoC