Skip to content

Cross-platform electron app for managing git users while pair/mob programming

Notifications You must be signed in to change notification settings

pluralsight/git-collaborate

Repository files navigation

Git Collaborate

Cross-platform electron app, git-collab, for managing git users while pair/mob programming

What happened to git-switch?

With the introduction of the switch command to git 2.23.0, we have opted to rename to something that:

  1. Does not conflict with core git functionality/commands
  2. Expresses the true behavior and intent of the application, namely collaborative software development

Upgrading from git-switch 1.x to git-collab 2.x

Your existing ~/.git-switch/config.json file will be copied to ~/.git-collab/config.json to keep your configured users and repositories.

Any repositories initialized with the post-commit.git-switch hook will be switched over to use the post-commit.git-collab hook.

Installation

  • You will find deployables for each of the 3 major platforms here.
  • Install git-collab for your platform and run it.
  • You should see a new tray item with the git-collab icon.
  • Add your git repos and pair/mob users.
  • Enjoy!

How it works

Co-Authors

git-collab adds a post commit hook to the git repositories you specify.

You select the users to add to your pair/mob, and commit changes to your code.

With each commit, the git-collab commit hook amends the commit to designate the author separate from the co-author(s).

Once each commit is complete, git-collab will automatically rotate users in your pair/mob, so the next user will be the author on the next commit.

WSL users

If you are using Windows Subsystem for Linux and you are not seeing co-authors applied with commits, you may need to symlink your global .gitconfig in your Linux instance to point to your global .gitconfig in Windows. i.e. You will want to run the following in your Linux shell:

rm ~/.gitconfig
ln -s /mnt/c/Users/<user>/.gitconfig ~/.gitconfig

Likewise, if you are making a commit from your Linux shell, the command issued to rotate users may not be able to run from the Linux shell, because it is a Windows .exe, so you'll need to manually rotate users after commits.

Identities

git-collab will modify your ssh config (~/.ssh/config) to specify the current author's identity file (RSA key).

By default, it does this for the github.com host.

If you use a different host for your repository, you can provide the SSH Host value, in the add/edit user form, that your identity file was issued for.

CLI usage

In addition to managing users and repositories in the electron client app, git-collab can also be used as a CLI i.e.

git-collab users add --name "<User Name>" --email "<[email protected]>"
git-collab repos list

Note: You will need to ensure git-collab is in your PATH. On MacOS it might look like this: sudo ln -s /Applications/git-collab.app/Contents/MacOS/git-collab /usr/local/bin/git-collab

The available command structure is:

git-collab
  users
    add (new)
    edit (up, update)
    remove (rm)
    list (ls)
    rotate (ro)
    toggle (to)
  repos
    add (new)
    remove (rm)
    list (ls)
  show
  quit

Running -h or --help on any command/sub-command will provide usage information

Development

To run git-collab from source, run the following command:

npm run build
npm run start

To launch the electron app with the chrome dev tools open by default, simply run:

npm run start:dev

Publishing a release

  1. Increment the version in package.json (Appropriately following SemVer)
  2. Tag the commit with git tag <semver>
    • Do not include a leading v in the tag name
    • ❌ v1.1.1
    • ✅ 1.1.1
  3. Push the tag to github git push --tags
  4. A release will be automatically generated by this github action
  5. Add notes/changelog to the newly created release