Gitsu

User management and pairing for Git

View the Project on GitHub drrb/gitsu

Usage Examples

Switching users

Switch to fully-qalified users

$ git su 'Joseph Porter KCB <jporter@example.com>'
Switched local user to Joseph Porter KCB <jporter@example.com>

Switch to configured users by initials

$ git su jp
Switched local user to Joseph Porter KCB <jporter@example.com>

or by part of their name

$ git su straw
Switched local user to Raphe Rackstraw <rrack@example.com>

To clear all Git users

$ git su --clear
Clearing all users from Git config

Adding users

To add a user to Gitsu (the user will be saved in ~/.gitsu)

$ git su --add 'Raphe Rackstraw <rrack@example.com>'
User 'Raphe Rackstraw <rrack@example.com>' added to users

You can also add users manually to ~/.gitsu in the following format:

jporter@example.com: Sir Joseph Porter KCB 
rrack@example.com: Raphe Rackstraw

Checking current users

Show current Git users in all scopes

$ git su
Current user: Raphe Rackstraw <rrack@example.com>

Local: Raphe Rackstraw <rrack@github.com>
Global: Raphe Rackstraw <rrack@example.com>
System: (none)

Show the current Git users in specified scopes (simplified output for use in scripts)

$ git su --local --global
Raphe Rackstraw <rrack@myproject.example.com>
Raphe Rackstraw <rrack@mycompany.example.com>

Show the current Git user that Git would use to commit

$ git whoami
Raphe Rackstraw <rrack@example.com>

Scopes

Gitsu supports Git's configuration scopes: local (current repository), global (current OS user), and system (everyone on the system). As with Git, if you don't specify a scope, local scope is assumed.

To change the user for a specific scope

$ git su joe --system
Switched system user to Joseph Porter KCB <jporter@example.com>

To clear the user for a specific scope

$ git su --clear --global
Clearing Git user in global scope

Miscellaneous Features

To display the options available for Gitsu

$ git su --help

To list all the users Gitsu knows about

$ git su --list
Joseph Porter KCB <joe@example.com>
John Galt <john@example.com>

To open the Gitsu config file in an editor (the same one Git uses)

$ git su --edit