Git User Switcher - Simple command line utility for quickly/easily switching between local git users
Install via Homebrew (currently macOS only):
brew install jamieweavis/tap/gus
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 users in your gus
config:
$ gus ls
* 0: Johnny <john.doe@gmail.com>
1: John Doe <john.doe@corporation.io>
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
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
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:
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:
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!
Compile a release binary:
cargo build --release
Run the release binary:
cargo run --release
Run in development mode:
cargo run
Install the binary to your system:
cargo install --path .
Uninstall the binary from your system:
cargo uninstall gus
I'm not a Rust developer, this is just for fun!
- jamieweavis/homebrew-tap - Homebrew tap for my brew formulae
This project is licensed under the MIT License - see the LICENSE file for details.