|
| 1 | +# GitProf |
| 2 | + |
| 3 | +[](https://opensource.org/licenses/MIT) |
| 4 | +[](https://pypi.org/project/gitprof) |
| 5 | + |
| 6 | + |
| 7 | +## Introduction |
| 8 | + |
| 9 | +GitProf ("Git Profiles") is a tool which simplifies working with multiple Git accounts. |
| 10 | + |
| 11 | +GitProf helps you with: |
| 12 | + |
| 13 | +- Using different Git services (e.g. GitHub and GitLab). |
| 14 | +- Using multiple accounts on GitHub (e.g. personal and work accounts). |
| 15 | + |
| 16 | +It solves the problems which you may experience when using multiple accounts/services: |
| 17 | + |
| 18 | +- You can't clone a repository easily because your default SSH key is for a different account/service. |
| 19 | +- Once you clone the repository, local Git config values such as `user.email` need to be set correctly. |
| 20 | + |
| 21 | +GitProf doesn't change your Git workflow; after using `gitprof clone` or `gitprof profile apply` on a repository, you don't need to interact with `gitprof` again for that repository. |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +Requirements: |
| 26 | + |
| 27 | +- Python 3.7 or higher, with the `pip` package manager (which is usually installed by default). |
| 28 | +- Windows, Linux or macOS. |
| 29 | + |
| 30 | +When installed with `pip`, the `gitprof` executable is automatically added to the `PATH` and behaves as a standalone program. |
| 31 | + |
| 32 | +To install GitProf with `pip`, run the command: |
| 33 | + |
| 34 | +```bash |
| 35 | +pip install gitprof |
| 36 | +``` |
| 37 | + |
| 38 | +Now you can run `gitprof version` to check that it is installed and available on the `PATH`. |
| 39 | + |
| 40 | +## Quick Start |
| 41 | + |
| 42 | +GitProf stores *profiles* which contain the information required to configure repositories for different accounts. When you run a command which uses a profile, you will be prompted to choose an existing profile or create a new one. |
| 43 | + |
| 44 | +### Cloning a new repository |
| 45 | + |
| 46 | +To clone a repository, just use `gitprof clone` instead of `git clone`. For example: |
| 47 | + |
| 48 | +```bash |
| 49 | +>> gitprof clone git@github.com/some-profile/some-repo.git |
| 50 | + |
| 51 | +### Choose a profile to clone with ### |
| 52 | +[0] github (GitHub) |
| 53 | +[2] gitlab (GitLab) |
| 54 | +[3] <CREATE NEW PROFILE> |
| 55 | +Enter a number from the list to choose an option [default=0]: 1 |
| 56 | + |
| 57 | +Cloning 'git@github.com/some-profile/some-repo.git' with profile: gitlab |
| 58 | + |
| 59 | +Setting local Git config values for 'some-repo'... |
| 60 | +Setting your Git name to 'MyUsername'... |
| 61 | +Setting your Git email to 'MyGitEmail'... |
| 62 | +Setting your Git SSH command to 'ssh -i ~/.ssh/my_ssh_key'... |
| 63 | +Finished setting up your Git repository. |
| 64 | +``` |
| 65 | + |
| 66 | +### Applying a profile to an existing repository |
| 67 | + |
| 68 | +If you have an existing repository whose config values you wish to change, you can `cd` into the repository and use `gitprof profile apply`. For example: |
| 69 | + |
| 70 | +```bash |
| 71 | +>> cd my-repo |
| 72 | +>> gitprof profile apply |
| 73 | + |
| 74 | +### Choose a profile to apply ### |
| 75 | +[0] github (GitHub) |
| 76 | +[2] gitlab (GitLab) |
| 77 | +[3] <CREATE NEW PROFILE> |
| 78 | +Enter a number from the list to choose an option [default=0]: 1 |
| 79 | + |
| 80 | +Setting local Git config values for 'some-repo'... |
| 81 | +Setting your Git name to 'MyUsername'... |
| 82 | +Setting your Git email to 'MyGitEmail'... |
| 83 | +Setting your Git SSH command to 'ssh -i ~/.ssh/my_ssh_key'... |
| 84 | +``` |
| 85 | + |
| 86 | +> **Tip**: GitProf includes help info, even for subcommands. For example, you can use `gitprof profile --help` to see parameters for the `profile` subcommand. |
| 87 | +
|
| 88 | +## Developer Notes |
| 89 | + |
| 90 | +### Packaging the project |
| 91 | + |
| 92 | +```bash |
| 93 | +rm -r dist/ |
| 94 | +python -m pip install -r requirements-dev.txt -r requirements.txt |
| 95 | +python setup.py sdist |
| 96 | +python setup.py bdist_wheel |
| 97 | +twine upload dist/* |
| 98 | +``` |
0 commit comments