DEV Community

loading...

Creating co-authored commits--command line--git

blackode profile image blackode ・2 min read

Photo by [NeONBRAND](https://unsplash.com/photos/mqoLpeeYBic?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/search/photos/thanking-co-worker?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)Photo by NeONBRAND on Unsplash

Give Credits ⭐️ whoever deserves

Brief Story

Suppose, you are working on a project which uses the git tool for version management and it is a team project where you see multiple authors contributing the code.

You are assigned with a task and you took the help from one of the co-programmers to get it coded.

If you are really concerned about the help and want to credit the co-programmer then you can do that by making co-author-commit.

Giving credits to the programmer is sure of another help from him — blackode

Things to know Before adding a co-author to a commit

  1. Co-author Email
  2. Co-author’s commit to count as a contribution-use email associated with their Github account
  3. If co-author’s email is private, use their GitHub-provided no-reply email to protect their privacy.

TIP

Helping Co-author to find their no-reply email and get shared

settings > emails

no-reply github email finding

Co-authored-by commits

Here no things are unknown to you. But, we are doing things differently.

Just like you do for a regular commit message and after adding the meaningful description you need to add two empty new lines instead of adding a closing quotation " .

git commit -m "New style of coding
>
>

On the next line of the commit message, type
Co-authored-by: author-name <name@xxx.com> with specific information for each co-author. After the co-author information, add a closing quotation mark.

Adding multiple co-authors

Give each co-author their own line and Co-authored-by: commit trailer before closing quotation mark.

After adding your beautiful commit message, in the next push, the message appears with co-authors

The Live Execution

Hope you like them. Thanks for reading…

Join Our Telegram Channel

[https://t.me/blackoders](https://t.me/blackoders)https://t.me/blackoders

Happy Coding !

Discussion

pic
Editor guide
Collapse
coolgoose profile image
Alexandru Bucur

It's also implemented in Gitlab via this merge. It's not technically a built in GIT feature :)