https://github.com/niklasrosenstein/git-profile
Easily switch between multiple Git configuration profiles on an individual repository basis.
https://github.com/niklasrosenstein/git-profile
app cli git python
Last synced: 4 months ago
JSON representation
Easily switch between multiple Git configuration profiles on an individual repository basis.
- Host: GitHub
- URL: https://github.com/niklasrosenstein/git-profile
- Owner: NiklasRosenstein
- License: mit
- Created: 2021-08-08T23:56:02.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2025-11-27T23:06:14.000Z (7 months ago)
- Last Synced: 2025-11-30T01:51:30.374Z (7 months ago)
- Topics: app, cli, git, python
- Language: Python
- Homepage:
- Size: 90.8 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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 `.` 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:
```ini
[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 ` 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 ` after that and
commit again.
## Vendored Libraries
* [`gitconfigparser.py`](https://github.com/looking-for-a-job/gitconfigparser.py)
by looking-for-a-job @ GitHub
---
Copyright © 2012 Niklas Rosenstein