git-auto-config
v0.0.5
Published
Auto config diffient user.name and user.email in different git repos
Downloads
17
Maintainers
Readme
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"
# 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