DEV Community

Cover image for Managing Multiple Git Profiles with Ease: Introducing `gguser`
Shubhendra Singh Chauhan
Shubhendra Singh Chauhan

Posted on

3

Managing Multiple Git Profiles with Ease: Introducing `gguser`

If you're a developer juggling between work projects, personal side projects, and maybe even some open-source contributions, you're likely familiar with a common frustrationβ€”managing multiple Git identities on the same machine.

Imagine this scenario: You commit changes to your personal project and push them to GitHub, only to realize that your work email is attached to the commit. Or worse, you accidentally push a work-related change using your personal GitHub account. Fixing this means manually updating your Git config each time you switch contexts.

For years, developers have resorted to running:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Enter fullscreen mode Exit fullscreen mode

But this is tedious and error-prone. What if there was a better way?

Meet gguser

gguser is a simple yet powerful CLI tool designed to seamlessly switch between multiple Git user profiles. Whether you're switching between work, personal, or open-source accounts, gguser makes the process effortless.


πŸš€ Installing gguser

Installing gguser is quick and easy. Simply run:

npm install -g gguser
Enter fullscreen mode Exit fullscreen mode

Now, you have gguser available globally, ready to manage your Git profiles.


🎯 How to Use gguser

1️⃣ Adding Git Profiles

Before switching between Git users, you need to define them:

gguser add <profile_name> "<full_name>" "<email>" [ssh_key]
Enter fullscreen mode Exit fullscreen mode

Example:

gguser add work "Shubhendra Chauhan" "work@company.com" ~/.ssh/id_ed25520
gguser add personal "Shubhendra Singh Chauhan" "personal@email.com" ~/.ssh/id_ed25521
Enter fullscreen mode Exit fullscreen mode

Here, the SSH key is optional but useful if you want to authenticate using SSH.


2️⃣ Switching Between Git Profiles

Interactive Selection

Instead of remembering profile names, use:

gguser select
Enter fullscreen mode Exit fullscreen mode

You'll see a list of your configured profiles and can simply pick one.

Quick Switching

If you already know which profile you want to switch to, just run:

gguser <profile_name>
Enter fullscreen mode Exit fullscreen mode

Example:

gguser work
Enter fullscreen mode Exit fullscreen mode

This updates your Git global config instantly.


3️⃣ Checking Your Current Git User

Ever wondered which Git identity is active? Quickly verify using:

gguser now
Enter fullscreen mode Exit fullscreen mode

This command will display the currently configured Git user:

πŸ‘€ Current Git User: Shubhendra Singh Chauhan <personal@email.com>
Enter fullscreen mode Exit fullscreen mode

4️⃣ Managing Your Profiles

Listing All Profiles

To see all configured profiles, run:

gguser list
Enter fullscreen mode Exit fullscreen mode

Removing a Profile

No longer need a profile? Remove it:

gguser remove <profile_name>
Enter fullscreen mode Exit fullscreen mode

πŸ”— Linking a Profile to a Directory

Many developers work on different projects that require different Git identities. For example:

  • Your personal projects live in ~/projects/personal
  • Your work projects live in ~/projects/work

Instead of manually switching Git users each time, you can link a profile to a specific directory:

gguser link work
Enter fullscreen mode Exit fullscreen mode

Now, whenever you enter that directory, gguser will automatically use the correct Git profile.

To unlink:

gguser unlink
Enter fullscreen mode Exit fullscreen mode

πŸ”₯ Why gguser is a Game-Changer

βœ… No more accidental commits with the wrong Git identity

βœ… Seamlessly switch between work, personal, and open-source profiles

βœ… Automatic profile selection based on directories

βœ… Easily manage SSH keys

βœ… Developer-friendly CLI with an interactive selection mode


πŸ’‘ Contribute or Extend gguser

gguser is open-source, and contributions are welcome! If you have ideas for improvements or new features, feel free to submit a pull request. You can check out the repo here:

πŸ”— GitHub: https://github.com/withshubh/gguser

πŸ“¦ NPM: https://www.npmjs.com/package/gguser


🎯 Final Thoughts

For developers working with multiple Git accounts, gguser is a must-have tool. No more wasting time manually updating Git config settings or dealing with incorrect commit histories. Try it out today and simplify your workflow!

Let me know in the comments how gguser has helped you! πŸš€

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo πŸ“Šβœ¨

Top comments (1)

Collapse
 
ramkumar-m-n profile image
Ramkumar M N β€’

Informative, Thanks

Jetbrains Survey

Calling all developers!

Participate in the Developer Ecosystem Survey 2025 and get the chance to win a MacBook Pro, an iPhone 16, or other exciting prizes. Contribute to our research on the development landscape.

Take the survey

AWS Security LIVE!

Hosted by security experts, AWS Security LIVE! showcases AWS Partners tackling real-world security challenges. Join live and get your security questions answered.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❀️