Building in public: How I added co authors to a pushed commit
Tags: github, git, beginners, tutorial
Published: 2022-07-28 15:41:26

I'll put my story on how I got here at the end for those looking for an answer quick:

##Documentation:
- [Multiple paragraphs on "git commit -m" command by Airton](https://airton.dev/til/multiple-paragraphs-on-git-commit-m-command/)
- [Creating a commit with multiple authors — Github Docs](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors)
- [Stack Overflow](https://stackoverflow.com/questions/72245016/is-it-possible-to-make-someone-a-co-author-on-a-past-commit-already-pushed-to-gi)

##What I did:
- `git log` to see what commits needed to be changed
- `git rebase -i HEAD~6` — I needed to rebase 6 commits
- Thanks to [what I learned about rebasing recently](###) I was able to use some vi(m?) tricks like `cw` to delete the `pick` quickly and change it to an `e` for edit.
- Use ```sh
git commit -m --amend "Commit message
dquote>
dquote>
dquote> Co-authored-by: Name <commit-email@email.com>
dquote> Co-authored-by: Another Name <another-commit-email@email.com>"
```
  - Pressing enter without the closing quotation will create the `dquote>` this means a new line has been created. (At least that's the case with zsh, idk if this is a standard)
  - Note the same name and commit-email we noted for [setting the GPG key](https://dev.to/sadiejay/how-i-got-two-computers-to-update-one-contribution-graph-under-as-one-github-user-1e0m) is needed here as well. So you'll want the people you're working with to verify their commit email
- Once you're happy with the message you can `git rebase --continue`
  - If you're not happy you can try again with the previous command.
- Repeat the previous two steps as needed
- Then `git push -force` was how I updated the remote, but it looks like `git push -force-with-lease` is a thing. I can't tell you the difference here so proceed with caution.

And done. I was really confused about the `dquote>` thing whenever I saw it previously lol Now I know it's just a new line haha




##Inspiration:
So I paired / mobbed programmed with some folks in the [Virtual Coffee community](https://virtualcoffee.io/). We add an action to my profile and update the CNAME to my custom domain [check me out, check me out!](sadiejay.online)

In the moment I was just creating commits and trying to keep up with the flow of the pairing. I learned so much got it all in the [README](https://github.com/sadiejay/portfolio) and had a lovely time!

Well I wanted to give some credit to the folks that helped me make this action! 

Recently, I had the wonderful experience of pairing and was credited for helping in the creation of tests and debugging process of a project written in Go. 

The experience really opened my eyes to the differences in statically typed vs dynamically typed languages and the power of an IDE. Most of what I did was listen and ask some questions, as almost everything went over my head, but it was fun? Kinda like being thrown into a conversation with someone that speaks a different language. Just trying to catch on and then starting to ask basic questions, I live for those interactions. 

Anyways, I'm in the front-end so this was much like watching some wizardry happen before my eyes haha But in the end I was asked if I [wanted to be co-author!](https://github.com/davidalpert/terraform-provider-pingdirectory) I loved that and wanted to be sure to do the same when this opportunity to mob program came up! And here we are :)