Coder Social home page Coder Social logo

git-auto-config's Introduction

git-auto-config

Auto config diffient user.name and user.email in different git repos.

✨✨✨ Don't worry about forgetting to switch git info again!!!.

Why?

There is always a need to use a different user.name and user.email in different git repos. For example, your company's repo want to use your company's username and email, but your personal repo want to use your personal name and email.

How?

Firstly, you need to config your rules by gitp p -r xxx -a xxx. Then, when you clone a repo by gitp clone, it will use your rules and auto to exec git config --local xxx.

Usage

Install

npm install -g git-auto-config

# or

yarn global add git-auto-config

# or

pnpm install -g git-auto-config

Alias(!important)

# mac

alias git="gitp"

# or

vim ~/.zshrc
alias git="gitp"


# window
to google~

config your git rules

only config once

# match git repository url contains `github`
gitp p -r "github" -a "name1 <[email protected]>"

# match git repository url contains `gitlab`
gitp p -r "gitlab" -a "name2 <[email protected]>"

clone your git repository

# Then this repository will be auto config --local user.name and user.email use `name1 <[email protected]>`
gitp clone https://github.com/xxx/xxxx.git

# Then this repository will be auto config --local user.name and user.email use `name2 <[email protected]>`
gitp clone https://gitlab.com/xxx/xxxx.git

config old project

# Provided that you have already configed your git rules by `gitp p xxx`

gitp s

gitp commands

proxy | p

add git proxy rules

  • -r, --rule <rule>
  • -n, --name <name>
  • -e, --email <email>
  • -a, --author <author>

e.g.

gitp p -r github -a "name1 <[email protected]>"

# or

gitp p -r github -n name1 -e [email protected]

set | s

manual set current project(Make sure you had set the rule by gitp p xxx)

e.g.

gitp s

# or

gitp set

proxy-show | ps

show your config

  • -l, --list
  • -r, --rule <rule>

e.g.

# show rule `github` config
gitp ps -r github

# show all
gitp ps

proxy-delete | pd

delete your config

  • [...rules]
  • -a, --all

e.g.

# delete rule `github` and `gitlab`
gitp pd github gitlab

# delete all
gitp pd -a

-v | -h

e.g.

gitp -v

gitp -h

gitp p -h

gitp ps -h

gitp pd -h

git commands

Of course, you can continue use all the git command by gitp xxx, that's the same with git.

LICENSE

MIT License © 2022-PRESENT ChpShy

git-auto-config's People

Contributors

patrickchen928 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

coderlyu

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.