Skip to main content

Easily switch between Git configurations on a per-repository basis.

Project description

git-profile

This command-line tool allows you to define a set of configuration profiles that can be applied on a per-repository basis. The main use case is to swap the user details and signing key, but it's not limited to just that.

Installation

We recommend installing the tool with Pipx.

$ pipx install git-profile

Configuration

In ~/.gitconfig, prefixing section names with <Profile>. assigns them to the specified profile. Git-profile can use that information to determine which profiles there are and what configuration is associated with it.

Example:

[Work.user]
  email = "me@work.com"
  signingkey = DEADBEEFDEADBEEF

Usage

Run git profile to list available profiles. The current profile will be marked with a star. Note that the default profile is always present and represents your normal Git configuration without profile overrides.

$ git profile
* default
  Work

With git profile <Profile> you can switch to the specified profile.

$ git profile Work
Switched to profile "Work".

The changes will be applied to .git/config of the current repository.

You can add the --diff option to print a diff of the applied config changes.

FAQ

How do I avoid accidentally forgetting to switch my profile after checking out a repository?

You can leave the [user] section of your default configuration empty. That way Git will prompt you to configure it when trying to commit. Simply run git profile <Profile> after that and commit again.

Vendored Libraries


Copyright © 2012 Niklas Rosenstein

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_profile-1.1.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

git_profile-1.1.3-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file git_profile-1.1.3.tar.gz.

File metadata

  • Download URL: git_profile-1.1.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.4 CPython/3.10.14 Linux/5.10.216-204.855.amzn2.x86_64

File hashes

Hashes for git_profile-1.1.3.tar.gz
Algorithm Hash digest
SHA256 8ef262f60bc530c1337925ba8c35d5177e57300ef9109432e4f3b68eccdbf0ad
MD5 8d22a7996704cc7ce842a118437d8b33
BLAKE2b-256 349c35a9d076079f92b077bcdbe5513720f3618a627da634cedc1e6fcf6e166c

See more details on using hashes here.

File details

Details for the file git_profile-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: git_profile-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.4 CPython/3.10.14 Linux/5.10.216-204.855.amzn2.x86_64

File hashes

Hashes for git_profile-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 679c211eee51321c058bdcdc6b71092e525086288bfd0a4198c07c0b0e4231fe
MD5 ae90c90bd651feaf9b9bea3e7c2574e9
BLAKE2b-256 da2b107bc748d2200274e5cbb2e00f14697ad4e8b1731f7b08d81de53ae1fd42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page