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 (over 2 years ago)
- Last Synced: 2024-06-22T21:10:20.103Z (5 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
[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/gesquive/git-user/blob/master/LICENSE)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/gesquive/git-user)
[![Build Status](https://img.shields.io/circleci/build/github/gesquive/git-user?style=flat-square)](https://circleci.com/gh/gesquive/git-user)
[![Coverage Report](https://img.shields.io/codecov/c/gh/gesquive/git-user?style=flat-square)](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!