rkotze / git-mob

Co-author commits tool. A cross-platform command-line tool for social coding. Includes co-authors in commits when pair/mob programming.
https://www.npmjs.com/package/git-mob
MIT License
182 stars 21 forks source link

Only add co-author from GitHub when it's desired #97

Closed jonsmithers closed 1 year ago

jonsmithers commented 1 year ago

Summary

In my experience with my pairs, adding usernames from GitHub (https://github.com/rkotze/git-mob/issues/74) is always accidental.

Just to be super clear, here's an example:

Let's say I'm Jane Doe, and I'm pairing with Amy Doe and Bob Doe. I go to add them as pairs, expecting to see this:

$ git ad bd
Jane Doe <jane@example.com>
Amy Doe <amy@example.com>
Bob Doe <bob@example.com>

But I haven't yet added them to ~/.git-coauthors, so instead I see:

$ git mob ad bd
Jane Doe <jane@example.com>
Daniel Apatin <35623+ad@users.noreply.github.com>
Ben Dean <146863+bd@users.noreply.github.com>

I've inadvertently added GitHub users ad and bd. And this is persisted in ~/.git-coauthors file.

Motivation

Avoids confusion/frustration, especially for brand new users.

Describe alternatives you've considered

Additional context

jonsmithers commented 1 year ago

I have a few ideas for solutions. My personal preference is 3.

  1. Only add users from github if you specify a flag. For example:
    $ git mob ad
    ERROR: co-author with initials "ad" not found
    $ git mob --github jonsmithers
    Jane Doe <jane@example.com>
    Jon Smithers <2660313+jonsmithers@users.noreply.github.com>
  2. Only add users from github if you confirm a prompt. For example:

    $ git mob jonsmithers
    ERROR: Co-author "jonsmithers" not found.
    Would you like to add "Jon Smithers <2660313+jonsmithers@users.noreply.github.com>" from GitHub (y/n)? y
    
    Jane Doe <jane@example.com>
    Jon Smithers <2660313+jonsmithers@users.noreply.github.com>
  3. Make the behavior configurable. For example:
    $ git mob ad
    ERROR: co-author with initials "ad" not found.
    To automatically add users from GitHub, run "git config --global mob.github true"
    $ git config --global mob.github true
    $ git mob ad
    Jane Doe <jane@example.com>
    Daniel Apatin <35623+ad@users.noreply.github.com>
rkotze commented 1 year ago

Hey @jonsmithers

Thanks for pointing this out and I can definitely see it being confusing for newer users.

I like your suggestions and probably best to use a flag and/or the config.

rkotze commented 1 year ago

Fixed in version v2.3.5