Skip to content

Git User Switcher - Simple command line utility for quickly/easily switching between local git users

License

Notifications You must be signed in to change notification settings

jamieweavis/gus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gus

Git User Switcher - Simple command line utility for quickly/easily switching between local git users

ci downloads version license

Installation

Install via Homebrew (currently macOS only):

brew install jamieweavis/tap/gus

Usage

Switch

Switch to a user by their ID:

$ gus 0
Switched git user to: Johnny <john.doe@gmail.com>

Switch to the previous user:

$ gus -
Switched git user to: John Doe <john.doe@corporation.io>

List

List users in your gus config:

$ gus ls
* 0: Johnny <john.doe@gmail.com>
  1: John Doe <john.doe@corporation.io>

Edit

Edit your gus config in your configured $EDITOR:

$ gus edit

Note

Alternatively you can edit the file at ~/.config/gus.toml - see the configuration section for more details

Help

Print usage and package information:

$ gus

gus 1.0.1 (https://github.com/jamieweavis/gus)

Git User Switcher - Simple command line utility for quickly/easily switching between local git users

Usage: gus <command>

COMMANDS
  <id>       Switch to user with the provided ID
  -          Switch to the previous user
  list, ls   List users and their IDs
  config     Open `~/.config/gus.toml` in your $EDITOR

Configuration

When you run gus for the first time a ~/.config/gus.toml file is created. This file is used to store your git users and is prepopulated with a your current git user.

As this is a Rust project, the config file is in TOML format and is structured as follows:

Initial Config

previous_user = 0
current_user = 0

[[users]]
name = "<your current git user name>"
email = "<your current git user email>"

Additional users can be added to the users array by using Array of Tables syntax:

Example Config

previous_user = 1
current_user = 0

[[users]]
name = "Johnny"
email = "john.doe@gmail.com"

[[users]]
name = "John Doe"
email = "john.doe@company.com"

Warning

The previous_user and current_user fields are updated by gus when you switch users - don't manually edit these fields!

Building Locally

Production

Compile a release binary:

cargo build --release

Run the release binary:

cargo run --release

Development

Run in development mode:

cargo run

Install

Install the binary to your system:

cargo install --path .

Uninstall the binary from your system:

cargo uninstall gus

Disclaimer

I'm not a Rust developer, this is just for fun!

Built With

Related

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Git User Switcher - Simple command line utility for quickly/easily switching between local git users

Resources

License

Stars

Watchers

Forks

Languages