The problem is that committing to the main branch every day makes the history messy, but commits made in other branches do not appear in the GitHub contribution graph (the green boxes).

What can I do so that my daily contributions count in the contribution graph, while keeping only the important milestone commits on the main branch?

4 Replies 4

Well, your contributions do show up from any branch, not just main. If you're not seeing green boxes, check if the commits are made with the email linked to your GitHub account (that happened to me). 2) the repository isn't a fork (contributions to forks don't count unless merged upstream) and 3) commits are within the last year.

Your can also see Github contribution documentation for details. I hope that answer your question and may help.

@jared-mccarthy From the docs you pointed to:

Commits are only counted if they are made in the default branch or the gh-pages branch

(Emphasize mine — phd)

Not from any branch.

@phd sorry, my bad and yes you are right. the Contributions only count from default or gh-pages branches. You can use squash merges and commit daily in feature branches, then git merge --squash to main for clean history. Each squashed merge counts as one contribution.I hope that answer your question.

If you want to see a "clean" mainline just git log --first-parent -m it, all merges to it will be displayed as if they were squash merges. Commits made on side branches but not (yet) merged are not yet part of the main history.

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.