Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gesquive/git-user
Git plugin that allows you to save multiple user profiles and set them as project defaults
https://github.com/gesquive/git-user
git git-addons git-plugin
Last synced: 3 months ago
JSON representation
Git plugin that allows you to save multiple user profiles and set them as project defaults
- Host: GitHub
- URL: https://github.com/gesquive/git-user
- Owner: gesquive
- License: mit
- Created: 2016-07-20T21:43:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T02:23:47.000Z (almost 3 years ago)
- Last Synced: 2024-08-03T22:19:26.436Z (7 months ago)
- Topics: git, git-addons, git-plugin
- Language: Go
- Homepage:
- Size: 49.8 KB
- Stars: 44
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - gesquive/git-user - Git plugin that allows you to save multiple user profiles and set them as project defaults (Go)
README
# git-user
[](https://github.com/gesquive/git-user/blob/master/LICENSE)
[](https://pkg.go.dev/github.com/gesquive/git-user)
[](https://circleci.com/gh/gesquive/git-user)
[](https://codecov.io/gh/gesquive/git-user)Git plugin that allows you to save multiple user profiles and set them as project defaults
### Why?
I created this because I have multiple emails that I use for work, personal, and open source projects and I would find myself checking into a git project with the wrong profile. Instead of manually changing the git config for a project every time, this was much easier.## Installing
### Compile
This project requires go1.18+ to compile. Just run `go install github.com/gesquive/git-user@latest` and the executable should be built for you automatically in your `$GOPATH`.Optionally you can run `make install` to build and copy the executable to `/usr/local/bin/` with correct permissions.
### Download
Alternately, you can download the latest release for your platform from [github](https://github.com/gesquive/git-user/releases/latest).Once you have an executable, make sure to copy it somewhere on your path like `/usr/local/bin` or `C:/Program Files/`.
If on a \*nix/mac system, make sure to run `chmod +x /path/to/git-user`.### Homebrew
This app is also avalable from this [homebrew tap](https://github.com/gesquive/homebrew-tap). Just install the tap and then the app will be available.
```shell
$ brew tap gesquive/tap
$ brew install git-user
```## Usage
If the `git-user` executable is placed on the path, it can be used as a git command. For example, you would be able to run the command `git user list` to list all of the configured users.
```console
git-user lets you quickly switch between multiple git user profilesUsage:
git-user [flags] [command]Available Commands:
add Add a new profile
del Delete a profile
edit Edit a profile
list List all saved profiles
rm Remove a profile from the current project
set Set the profile for the current projectFlags:
-c, --config string config file (default "~/.git-profiles")
-g, --git-path string The git executable to use (default "git")
-p, --path string The project to get/set the user (default "$CWD")
-V, --version Show the version and exit
```Optionally, a hidden debug flag is available in case you need additional output.
```console
Hidden Flags:
-D, --debug Include debug statements in log output
```## QuickStart
```console
$ cd /path/to/git/project# add a work profile for Henry
$ git user add work "Dr. Henry Jekyll" [email protected]
Added profile 'work'# add a personal profile for Edward
$ git user add home "Edward Hyde" [email protected]
Added profile 'home'# list out our saved profiles
$ git user list
Global Profile:
User: HenrySaved Profiles:
home: Edward Hyde
work: Dr. Henry Jekyll# set the current git repository user to the home profile
$ git user set home
The user for the 'project' repository has been set too 'Edward Hyde '# list profiles again, notice how the current repository profile is now set
$ git user
Project Profile:
Path: /path/to/git/project
User: Edward HydeSaved Profiles:
home: Edward Hyde
work: Dr. Henry Jekyll
```## Documentation
This documentation can be found at github.com/gesquive/git-user
## License
This package is made available under an MIT-style license. See LICENSE.
## Contributing
PRs are always welcome!