Git Product home page Git Product logo

git-user's Introduction

git-user

Software License GoDoc Build Status Coverage Report

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.

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. Just install the tap and then the app will be available.

$ 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.

git-user lets you quickly switch between multiple git user profiles

Usage:
  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 project

Flags:
  -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.

Hidden Flags:
  -D, --debug                  Include debug statements in log output

QuickStart

$ 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: Henry <[email protected]>

Saved Profiles:
  home: Edward Hyde <[email protected]>
  work: Dr. Henry Jekyll <[email protected]>

# 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 <[email protected]>'

# list profiles again, notice how the current repository profile is now set
$ git user
Project Profile:
  Path: /path/to/git/project
  User: Edward Hyde <[email protected]>

Saved Profiles:
  home: Edward Hyde <[email protected]>
  work: Dr. Henry Jekyll <[email protected]>

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!

git-user's People

Contributors

gesquive avatar giginet avatar lewiscowper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

git-user's Issues

Add to brew?

Awesome project! May you add it to Homebrew to make it easier the installation and update on Mac?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.