Skip to content

Feature request: Git Co-author #678

Open
@ArrayKnight

Description

@ArrayKnight

For companies that do a fair amount of paired programming, it's valuable to be able to represent multiple authors for commits. So we use Git's co-author feature:
https://help.github.com/en/articles/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line

It would be great if this was a feature with these capabilities:

  • Have a step in the CLI that asks for a co-author (after everything else?)
  • Automatically add the bash profile in context as one of the authors (if additional co-authors are selected)
  • Automatically add co-authors via global config (workstation) and/or project config
  • Provide list of easy to add co-authors via global config (workstation) and/or project config
  • Co-author tag for custom commit message template

Activity

alvarolorentedev

alvarolorentedev commented on Aug 3, 2022

@alvarolorentedev

@ArrayKnight I am currently using https://www.npmjs.com/package/cz-format-extension to achieve this using the list of contributors on package.json. You can see the code here.

const { contributors } = require('./package.json')
....
module.exports = {
  questions({inquirer}) {
    return [
      ...
      {
        type: 'checkbox',
        name: 'coauthors',
        message: 'Select Co-Authors if any:',
        choices: contributors.map(contributor => ({
            name: contributor.name,
            value: `Co-authored-by: ${contributor.name} <${contributor.email}>`,
        }))
      },
    ]
  },
  commitMessage({answers}) {
    ....
    const coauthors = answers.coauthors.join('\n');
    ....
  }
}
p-m-p

p-m-p commented on Jun 26, 2023

@p-m-p

I was looking for similar solution to this but didn't find anything so added a wrapper for cz-conventional-changelog to add co-authors https://github.com/p-m-p/cz-conventional-changelog-coauthors.

Happy to provide as a proper feature to one of the core libraries if desired.

antono4

antono4 commented on Jun 27, 2023

@antono4

how to Creating a commit with multiple authors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @p-m-p@dmwelch@alvarolorentedev@ArrayKnight@antono4

        Issue actions

          Feature request: Git Co-author · Issue #678 · commitizen/cz-cli