DEV Community

Aliya Lewis
Aliya Lewis

Posted on

Trouble with Git Commits on Github? Me too.

Lately, I've been having some issues getting all my commits to show on my GitHub profile. I've worked on several projects over the past couple of weeks but for some reason, my profile looks like I haven't really done anything. Here's my chart:

Alt Text

From mid-September on, you can see that it's pretty light on the green squares. There are at least 50 commits missing but I'm not sure why that is.

I've tried checking:

  • that my terminal is connected to the right GitHub account
  • my GitHub contribution settings
  • that the commits are showing up in my repos (they are)

I don't have GitHub Desktop so it's not an issue with that. Recently, I used the internet at a radio station and ran into some issues pushing to my repo because of the radio station's internet security. Could that be a factor?

Do any of you have any ideas as to what might be causing this?

Here are the places I've looked for already but haven't found anything that has helped me (but it might help you, depending on your issue):

Top comments (9)

Collapse
 
jenshaw profile image
Jenny Shaw • Edited

I too discovered a couple of weeks ago that a substantial number of my commits weren't showing up on GitHub. After some research, I learned that because I was working on a non-master branch, none of my previous commits that I'd pushed would count even after I merged the branch to master. In the end, the only commit that was added to my GitHub graph was the merge.

So it seems the lesson is, if you want more commits to show on your page, you pretty much need to work entirely on master or merge to your master branch all. the. time.

Edit: The experience was legit, but the 'lesson' is not entirely true. Updated new findings in a later comment.

Collapse
 
aliyalewis profile image
Aliya Lewis

Huh, that's interesting. Seems like not a good representation of work though.

Collapse
 
jenshaw profile image
Jenny Shaw

I agree about it seeming a terrible representation of your work. I've been working around the problem, but I'm pretty dissatisfied with my workflow. So I did some more digging.

And it turns out what I wrote last night was a little inaccurate. It's not the master, but the 'default' that is the only branch that can populate commits onto the graph, but it happens to be that default is set to master. It sounds like you can set the default to another branch to reflect the commits you make there.

help.github.com/en/github/setting-...

It seems a little tedious, but it's a solution. Not sure if commits appear or disappear on your graph though if you're setting your default to something else all the time. Might be worth experimenting with!

By the way, have you figured out yet what the cause has been for you?

Thread Thread
 
aliyalewis profile image
Aliya Lewis

I haven't been able to figure it out because it seems like even if I'm working in the default branch the commits may or may not show up on the contribution graph. As long as the commits are showing up in the repo itself I'm not too worried about it, just wish the work was reflected in a better way.

Collapse
 
danstur profile image
danstur

Number of commits is about as useful as lines of code for measuring anything.

If I rebase and squash my commits before merging them into master have I suddenly done less work?
If I take a commit and split it into a separate commit for every file, have I suddenly done ten times more work?

There's really no reason to worry about this, no sane person would ever make decisions based on commit count.

Collapse
 
aliyalewis profile image
Aliya Lewis

Unfortunately, I'm in a position where commit count does matter, otherwise I wouldn't worry about it at all.

Collapse
 
fanjups profile image
Fanon JUPKWO

I face this problem too. Github told me
" Dec 9, 10:58 PM UTC

Hi Fanon,

Taking a look at your contributions from 2018 I see that you made quite a lot of contributions during November and December of 2018. As the year 2019 progresses, some of those older contributions made during late 2018 are falling off and are no longer included in the contribution count for the past 12 months. If you visit the link for your contributions during 2018 you will still be able to see these 350 contributions. "

Collapse
 
aliyalewis profile image
Aliya Lewis

That's interesting, I'll have to check that out.

Collapse
 
andymagill profile image
Andrew Magill

Both your links point to the cause. You don't see the commits because you are not committing to the default branch. If you change the default branch to the one you have been working on, your activity should show your commits. Also, according to GitHub help, your commits should show once you merge to your default branch.