Lädt...

🔧 Managing Multiple Git Profiles with Ease: Introducing `gguser`


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

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 "[email protected]"

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

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]

Example:

gguser add work "Shubhendra Chauhan" "[email protected]" ~/.ssh/id_ed25520
gguser add personal "Shubhendra Singh Chauhan" "[email protected]" ~/.ssh/id_ed25521

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

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>

Example:

gguser work

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

This command will display the currently configured Git user:

👤 Current Git User: Shubhendra Singh Chauhan <[email protected]>

4️⃣ Managing Your Profiles

Listing All Profiles

To see all configured profiles, run:

gguser list

Removing a Profile

No longer need a profile? Remove it:

gguser remove <profile_name>

🔗 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

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

To unlink:

gguser unlink

🔥 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! 🚀

...

🔧 Managing Multiple Git Profiles with Ease: Introducing `gguser`


📈 95.46 Punkte
🔧 Programmierung

🔧 Managing Profiles with Ease


📈 36.33 Punkte
🔧 Programmierung

🔧 Managing Multiple SSH Keys &amp; Git Profiles with xks


📈 35.72 Punkte
🔧 Programmierung

🔧 Introducing GitHotswap: Switch Git Profiles Like a Pro


📈 28.4 Punkte
🔧 Programmierung

🐧 GitHub - TheYkk/git-switcher: Switch between your git profiles easily


📈 27.92 Punkte
🐧 Linux Tipps

🔧 "Space-Ease: Rent Your Space, Park With Ease"


📈 26.96 Punkte
🔧 Programmierung

🔧 Multiple git configs (profiles) on one computer


📈 25.89 Punkte
🔧 Programmierung

🔧 Multiple git profiles without manually switching the config


📈 25.89 Punkte
🔧 Programmierung

🍏 Git annex 10.20230321 - Allows managing files with git.


📈 24.73 Punkte
🍏 iOS / Mac OS

🔧 Python Iterators and Generators: Managing Data Streams with Ease


📈 23.31 Punkte
🔧 Programmierung

🔧 GitHub Mastery: Creating Repositories and Managing PRs with Ease


📈 23.31 Punkte
🔧 Programmierung

🔧 Efficiently Managing Dynamic State Arrays in React: Adding and Removing Elements with Ease 📣


📈 23.31 Punkte
🔧 Programmierung

🔧 How Kubernetes is Revolutionizing the AI World: Managing Workloads with Ease


📈 23.31 Punkte
🔧 Programmierung

🔧 Managing Application Properties with Spring Boot Profiles: A Best Practices Guide


📈 22.85 Punkte
🔧 Programmierung

🐧 Tuned Switcher 0.4.0 - simple utility for managing performance profiles


📈 22.85 Punkte
🐧 Linux Tipps

🐧 I created a tool for managing profiles within dotfiles


📈 22.85 Punkte
🐧 Linux Tipps

🔧 Automate Your Git Commits with AI - Introducing `git-ai-commit


📈 22.83 Punkte
🔧 Programmierung

🔧 🚀 Introducing Git Styler: Make Your Git Commits Cleaner and Faster!


📈 22.83 Punkte
🔧 Programmierung

🔧 Managing Multiple SSH Keys for Different Git Hosting Platforms (GitLab &amp; GitHub)


📈 22.7 Punkte
🔧 Programmierung

🔧 Managing Multiple Git Identities on Windows for Different Projects


📈 22.7 Punkte
🔧 Programmierung

🔧 Managing Multiple Git Configs with SSH


📈 22.7 Punkte
🔧 Programmierung

🐧 hit: Managing multiple git repositories as a project


📈 22.7 Punkte
🐧 Linux Tipps

🔧 DAY 5 Git rebase, Git stash, Git cherry-pick.


📈 22.35 Punkte
🔧 Programmierung

🔧 Git Rebase and Git stash and Git pop -day 4


📈 22.35 Punkte
🔧 Programmierung

🔧 Ditch Git Checkout: Use Git Switch and Git Restore Instead


📈 22.35 Punkte
🔧 Programmierung

🔧 Restaurando e Alternando Branches com Git: Domine os Comandos git restore e git switch


📈 22.35 Punkte
🔧 Programmierung

🎥 Top Git Commands | Most Used Git Commands | Git Commands With Examples


📈 22.35 Punkte
🎥 Video | Youtube

🔧 git switch and git checkout – How to switch branches in git


📈 22.35 Punkte
🔧 Programmierung

🔧 Ever wished to maintain API Docs with ease? Introducing LiveAPI: Super Convenient API Docs


📈 21.41 Punkte
🔧 Programmierung

🔧 Introducing the PII Mask Maven Dependency: Secure Your JSON Data with Ease


📈 21.41 Punkte
🔧 Programmierung

🔧 Introducing Fullstack Next.js Support on Fleek: Build, Deploy, and Scale Dynamic Apps with Ease


📈 21.41 Punkte
🔧 Programmierung

🔧 Introducing Tapyr: Create and Deploy Enterprise-Ready PyShiny Dashboards with Ease


📈 21.41 Punkte
🔧 Programmierung

matomo