Don't lose your Github contributions when you leave an organization
Tags: github, org, tutorial, javascript
Published: 2022-05-28 06:33:56

As Software engineers there are often times in our careers when we change jobs, now this is a good thing since you get a significant raise 💰, the excitement of joining a new organization is also there and maybe you are also re-locating (to Bangalore?) to a new place. 

In this excitement, most of us forget that soon you will be kicked out of your previous Github organization, where you might have made hundreds if not thousands of commits during your tenure and once you are kicked out, all of these commits will disappear in a ✨ jiffy ✨ from you Github profile.

If you are someone like me who cares deeply about their Github profile, then you will be in deep regret ([like this person](https://github.com/isaacs/github/issues/1138)) if you don't do the needful to retain those contributions on your profile.
A Github profile for software engineers is like their resume or at least I treat it like one, hence it's important to keep it up-to-date, authentic and relevant. Having a consistent contributions graph on your Github profile helps you get noticed by possible future recruiters and in general, it shows your consistency as a software engineer.

> You can checkout my Github profile [here](https://github.com/bhatvikrant)

Now let's get into the meat of it 🎯

# It is important to understand when commits are shown
Commits will appear on your contributions graph if they meet all of the following conditions:

1. The email address used for the commits is associated with your account on GitHub.com.
2. The commits were made in a standalone repository, not a fork.
3. The commits were made in the repository's default branch

In addition, at least one of the following must be true:

- You are a collaborator on the repository or are a member of the organization that owns the repository.
- You have forked the repository.
- You have opened a pull request or issue in the repository.
- ✨ **You have starred the repository.** ✨

# So what can I do to keep my hard-earned contributions? 

Star the repositories you are contributing to in your organization. That way, your commits to those repositories will remain in your contributions graph even if you leave the organization that owns the repository or delete your fork of the repository.

# Before you leave your company, make sure you update the following information in your personal account:
1. Unverify your company email address by deleting it in your Email settings. You can then re-add it without verifying to keep any associated commits linked to your account.

2. Change your primary email address from your company email to your personal email.

3. Verify your new primary email address.

# FAQs
1) Regarding the advice to star the repos before leaving, does this mean that only commits post-starring will remain? Or is starring once sufficient to retain all past commits?

Ans - all commits will remain, so star the repositories as soon as you can just in case.

2) What if commits were made using a company email?

Ans - Unverify your company email address by deleting it in your Email settings. You can then re-add it without verifying to keep any associated commits linked to your account. ( [refer](https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings/best-practices-for-leaving-your-company
) )

# References
1. https://github.com/isaacs/github/issues/1138
2. https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/best-practices-for-leaving-your-company
3. https://github.community/t/getting-all-your-commits-in-your-contributions-graph/10186
4. https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile

> If this blog helped you then please share it with other engineers out there, I don't want any engineer to lose their contributions ever :)