Crates.io | gitprofile |
lib.rs | gitprofile |
version | 0.1.2 |
source | src |
created_at | 2022-07-12 09:19:30.320628 |
updated_at | 2022-07-15 21:52:06.952933 |
description | A CLI tool to manage git profiles |
homepage | |
repository | https://github.com/takuma7/git-profile/ |
max_upload_size | |
id | 624288 |
size | 65,804 |
Managing user.name
and user.email
can be cumbersome if you have multiple profiles.
git-profile
lets you create, manage, and switch between them with ease.
Optionally, you can also set user.signingkey
for signed commits.
The quickest way to get started is to run git profile import
and git profile apply <your-profile>
:
$ git profile import
Found a user config as follows:
user.name=Git Smith
user.email=smith@work.com
✔ Enter profile name · work
✨ Successfully imported a git user as work
$ git profile apply work
✨ Successfully applied work
If you haven't, install cargo
as follows:
curl https://sh.rustup.rs -sSf | sh
Then, run the following command to install git-profile
:
cargo install gitprofile
(The actual executable will be named git-profile
.)
USAGE:
git-profile [OPTIONS] <SUBCOMMAND>
OPTIONS:
-c, --config-path <CONFIG_PATH> Use the given path to the configuration file to read/write
profiles
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
apply Apply the given profile
config-dump Dump the content of the config file
config-path Print path to the config file
current Show the key or value of the current profile
edit Edit an existing profile
help Print this message or the help of the given subcommand(s)
import Import the current git config values as a profile
list List all profiles
new Create a new profile
remove Remove a profile
rename Rename the given profile with the given new name
show Show the details of the given profile
For a quick start, git profile import
allows you to import your existing profile:
$ git profile import
Found a user config as follows:
user.name=Git Smith
user.email=smith@work.com
✔ Enter profile name · work
✨ Successfully imported a git user as work
Alternatively, you can manually create a new profile with the git profile new
command:
$ git profile new
✔ Enter profile name · github
✔ Enter user name (user.name) · Git Smith
✔ Enter email (user.email) · smith@github.com
✔ Do you want to set signing key (user.signingkey) · no
✨ Created a new profile github
To switch between profiles, use the apply
subcommand:
$ git profile apply github
✨ Successfully applied github
Under the hood, this is equivalent to running the following command:
$ git config user.name "Git Smith"
$ git config user.email smith@github.com
git-profile
supports the config level flags (--local
, --global
, --system
, --worktree
, and --file
) out of the box.
list
gives you an overview of your profiles. *
indicates which profile is currently being activated.
$ git profile list
* work
github
current
gives you the key of the current profile:
$ git profile current
work
Use show
to see the details of a profile:
$ git profile show github
user.name=Git Smith
user.email=smith@github.com