Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

A git extension to allow you manage multiple git profiles on your workstation with ease

License

Notifications You must be signed in to change notification settings

MeNsaaH/git-profile-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Profile Manager

A git extension to allow you manage multiple git profiles on your workstation. User profiles can have independent configurations. They can also share configurations.

Python 3 PyPI version Build Status License: MIT


Installation

using Pip

Git-profile-manager can be installed using the python pip tool.

pip3 install git-profile-manager

# pip install git-profile-manager

## Upgrade
pip3 install git-profile-manager --upgrade

NOTE: After installation, your current git config will be used as a shared configuration. All users inherit from the configuration

Usage

Create Profile

To create a profile

  git create-profile 

  git create-profile -e [email protected] -n "Foo Bar"

To Configure profile:

  # Sets up ssh for that user
  git config --global core.sshCommand "ssh -i /full/path/to/id_a/id_rsa"

NOTE: Git Profile Manager stores the user config as global config. Hence all configurations must carry the --global flag. That means running config without the --global flag creates a local config that overrides values set on user config

  # Sets up ssh for that user
  # Set config for present repository
  # This Config overrides the user profile created config value for core.sshCommand
  git config core.sshCommand "ssh -i /full/path/to/id_a/id_rsa"

All initial global configurations are added to the user config. For conflicts, the user's config override the global config.

Global Configuration

To add configurations that would be shared by all users:

  git global-config core.sshCommand "ssh -i /full/path/to/id_rsa"

User's configuration always override global configuration

Apply profile

Applies a profile to a particular directory. Once applied, any repository within the directory uses the config.

  # Applies current user profile 
  git apply-profile /home/user/company

  # Applies specified user profile
  git apply-profile /home/user/personal -u personal

implemented using https://git-scm.com/docs/git-config#_conditional_includes

Switch between Profiles

To Switch Profile:

  git use-profile [email protected]

Remove Existing Profile

To Remove an existing Profile:

  git remove-profile [email protected]

Current Profile

To get the Current Profile:

  git current-profile

List Profiles

To list the Current Profile:

  git list-profiles

TODO

  • Add bash completions
  • Check and add windows compatibility
  • Tests

About

A git extension to allow you manage multiple git profiles on your workstation with ease

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages