Live data from Hacker News

Ask HN: How often do you commit / push in Git?

news.ycombinator.com

1–10 of 36 posts

Ask HN: How often do you commit / push in Git?

#1
So my company decided to try out the Scrum working methodology and hired an external consultant to get in order. The consultant was giving a talk and basic introduction about Scrum and stuff. He emphasized committing / pushing to Git on regular basis and said he knew people who pushed / committed like every 30 seconds. In my mind I was going WTF are you talking.

How often do you guys commmit / push ? I push in my changes when I have completely finished working on a feature / module

Re: Ask HN: How often do you commit / push in Git?

#2
You need at least an atomic change, i.e compiling/testing/deploying at that point makes sense.

If you just updated a typo in some comments, it could make sense to commit it and it could take 30 seconds.

Now if you are always committing as frequently, either you are working on very easy tasks with no dependencies, either there is an issue.

Re: Ask HN: How often do you commit / push in Git?

#3
I use Scrum and I usually commit about once an hour. More if I'm just bug-fixing or correcting typos or adding comments.

Committing every 30 seconds seems like it would knock me out of my flow so often that I wouldn't get anything done.

That being said, if I'm working in the same files as someone else, I'll commit every few minutes (and so will they) so that the amount of conflicts we're creating don't get out of hand.

Re: Ask HN: How often do you commit / push in Git?

#7
I'll commit for small, incremental changes. Each commit is a semantic change to me- could be a small change applied in the same way across multiple files, or a larger change in a single file that does one thing.

I tend to push at the first opportunity it makes sense for other people to see my code, and then push again whenever I make enough incremental progress towards the feature to share. Our team has a culture of opening "in progress" PRs early and often to get feedback before we are too far along. This is great to share ideas and feedback about how things should work (instead of just about how they do based on implementation). It also helps keep the final code review size / time down.

Re: Ask HN: How often do you commit / push in Git?

#8
We use a fork model where each developer has their own fork of the "main" repository and the developer fork is cloned to the local dev machine.

Using this model I do work in progress commits as needed for different features using many different branches. Those wips and committed locally and are pushed to the remote fork many times per day for backup. For example I can do a quick push before going to lunch or meeting. I can also fetch, rebase, squash, and force push commits as desired because the only history I am affecting is on my own fork. The final merge to the "main" repository is usually 1-2 commits squashed from all the wip commits. Once that is merged I, since I am usually working on a feature branch, I can delete that branch locally and in the remote fork.

Every 30 seconds seems like a bit much, but it wouldn't be unreasonable to say I commit and push 10x a day.

Re: Ask HN: How often do you commit / push in Git?

#9

I use Scrum and I usually commit about once an hour. More if I'm just bug-fixing or correcting typos or adding comments. Committing every 30 seconds seems like it would knock me out of my flow so often that I wouldn't get anything done. That being said, if I'm working in the same files as someone else, I'll commit every few minutes (and so will they) so that the amount of conflicts we're creating don't get out of han…

Curious, if Scrum makes you get into this mindset that you have to commit every hour ?

Re: Ask HN: How often do you commit / push in Git?

#10

I use Scrum and I usually commit about once an hour. More if I'm just bug-fixing or correcting typos or adding comments. Committing every 30 seconds seems like it would knock me out of my flow so often that I wouldn't get anything done. That being said, if I'm working in the same files as someone else, I'll commit every few minutes (and so will they) so that the amount of conflicts we're creating don't get out of han…

Curious, if Scrum makes you get into this mindset that you have to commit every hour ?

Maybe, but I think it's more of a continuous-delivery thing than a scrum thing. I just commit after I add anything meaningful to the codebase (to get it out to users as quickly as possible), and that usually ends up being once an hour.
Post reply on HN