https://github.com/vinugawade/gitswap
A lightweight CLI tool to easily manage and switch between multiple Git user profiles. Perfect for developers working on projects with different Git account.
https://github.com/vinugawade/gitswap
bash bats-core cli git github github-config linux macos switch test-automation user-management version-control
Last synced: 3 months ago
JSON representation
A lightweight CLI tool to easily manage and switch between multiple Git user profiles. Perfect for developers working on projects with different Git account.
- Host: GitHub
- URL: https://github.com/vinugawade/gitswap
- Owner: vinugawade
- License: gpl-3.0
- Created: 2024-12-29T12:23:34.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-29T17:18:24.000Z (over 1 year ago)
- Last Synced: 2025-06-04T04:15:11.108Z (about 1 year ago)
- Topics: bash, bats-core, cli, git, github, github-config, linux, macos, switch, test-automation, user-management, version-control
- Language: Shell
- Homepage: https://github.com/vinugawade/gitswap
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitSwap - Manage Git Users Easily 🔄






If you work with multiple Git users and need an easy way to switch between them, `gitswap` is the script for you. It allows you to list, add, remove, and switch Git users quickly on **Linux**, **MacOS**, and **Windows**.
---
## Installation 🚀
1. **Clone the Repository:**
- Clone the [gitswap](https://github.com/vinugawade/gitswap) repository to your local machine using the following command:
```bash
git clone https://github.com/vinugawade/gitswap.git
```
2. **Move the Script to a Global Location:**
- Move the script to a global location on your system using the following command:
```bash
sudo mv /location/of/gitswap /usr/local/bin
```
3. **Set Script Permissions:**
- Allow everyone to execute the script by choosing one of the following commands:
```bash
sudo chmod +x /location/of/gitswap
```
OR
```bash
sudo chmod 0755 /location/of/gitswap
```
4. **Add to $PATH:**
- Add `/usr/local/bin` to your `$PATH`. If you use the Bash shell, execute the command:
```bash
export PATH=$PATH:/usr/local/bin
```
OR
```bash
export PATH=$PATH:/location/of/gitswap
```
This will set the variable name, potentially in a file like `~/.bash_profile`, `~/.bashrc`, or `~/.profile`. If you're unsure where to put it, `~/.bashrc` is a good choice.
> **You may need to restart your shell for this to take effect.**
---
## Script Options 🎛️
The `gitswap` script supports the following options:
- `--switch, -s`: Switch to a new or existing Git user.
- `--add, -a`: Add a new Git user to the list.
- `--remove, -r`: Remove a Git user from the list.
- `--show, -sh`: Display the current Git user configuration.
---
## Usage 🛠️
- **Switch User:**
Switch to an existing Git user or add a new one if the user doesn't exist.
```bash
gitswap "John Doe" "john.doe@example.com"
```
- **Add User:**
Add a new Git user to the saved list.
```bash
gitswap --add # Prompts to add a new Git user to the list
gitswap "Jane Doe" "jane.doe@example.com" # Adds a new user if provided
```
- **Remove User:**
Remove a Git user from the saved list.
```bash
gitswap --remove # Prompts to choose a user to remove
```
- **Show Current User:**
Display the current Git user configuration.
```bash
gitswap --show # Displays the current Git user configuration
```
- **List Users:**
If no arguments or options are provided, `gitswap` will list all saved Git users.
```bash
gitswap # Lists all saved Git users
```
---
## Features 🌟
- **Switch Users:** Easily switch between multiple Git users.
- **Add Users:** Add new Git users to the saved list.
- **Remove Users:** Remove users from the saved list.
- **Show Current User:** Quickly view the currently active Git user.
- **Auto-Add:** If no users are saved, the current Git user is automatically added to the list.
---
## Maintainer 👨🏻💻
Built With 💙✨ By Vinay Gawade.
---
## License 🛂

This project is licensed under the [LICENSE](LICENSE) file associated with this repository.