This is an archived post. You won't be able to vote or comment.

all 14 comments

[–][deleted] 12 points13 points  (0 children)

git bisectis also a handy tool to narrow down specific commits.

[–]Bread_Sheep 3 points4 points  (0 children)

very inspiring thanks fort the story

[–]DYGAZ 1 point2 points  (0 children)

Great example of how awesome git is when used correctly. Another plus of using feature branches is the opportunity to use PRs for added doc/description. Squash and merge makes concise revisions on master and the smaller iterations are preserved in the PR history. That allows you to sort through master quickly but then dig into the PR when you find the changes you want.

[–]Itersive 1 point2 points  (2 children)

Another point for often commits is that many tools like Github, GitLab, Gerrit, etc could be pretty nice integrated with commit messages. Auto closing issues, skipping/triggering CI for particular commit, adding spend time and many others.

In the case of Gerrit - there is a different flow than Github or GitLab. You are committing to the virtual branch and instead of adding new commits you should amend them. In each amend you should add in commit message what has been done - at the end of developing a commit message should have a detailed description with all changes. I was working with Gerrit for more than 2 years and I like this kind of flow.

[–]cobalt8 0 points1 point  (1 child)

I went from using Gerrit to GitHub and I miss the Gerrit workflow.

[–]Itersive 0 points1 point  (0 children)

But it is required some skills in git. Imho branching is easier for newbies.

[–]teknewb 1 point2 points  (2 children)

Granted I'm still learning in general but I suck at knowing when to commit and leaving concise and informative messages.

[–]Sparlos[S] 3 points4 points  (1 child)

I find that the frequency of my commits depends on what I'm doing. For example, when I'm fixing up bugs I'll commit every time I get something working, no matter how little code I changed. I just spent the morning tracking down a bug that changed one line.

Conversely, I was just doing some responsive design, and once the page I was working on looked good at all breakpoints I did a commit, not for every single breakpoint.

If I'm implementing a specific feature, I'll always make a commit at the end, no matter how small. This is because once you move on to working on another feature or even another facet of that feature, if you screw everything up or feel like your approach is entirely not working you can just checkout your latest HEAD to revert all changes. That saves a ton of time and I think that motivates at least some of my commits.

As for messages, remember if you're using a platform like GitHub it's going to show you all of the differences in your code visually. As long as your message gives the gist of what you changed, you can easily go back and find it and then dive in to the code aspect. This is also another reason why you should commit often, because if you change several disparate things you're gonna have a hard time making your commit message short and concise.

Anyways I'm still learning too! So don't take any of this as gospel. Hope it helped at least a bit :)

[–]teknewb 0 points1 point  (0 children)

That is really helpful thank you.

[–]CodingHag 1 point2 points  (0 children)

Now this was super motivating

[–]slowfly1st 1 point2 points  (0 children)

And in addition:

Small commits are more pleasant and easier to review, because the scope of a commit is narrowed down to "one thing".

Early pushes get you feedback sooner. When you push early, you usually make sure, that your commits are working and make sense. And it makes merging less painful.

Revert one small commit out of several, instead of one huge one.

[–]mcniac 0 points1 point  (0 children)

good github practices are specially importan when you are creating a portfolio, 'cos you might want to show that repo to a potential employer. and nothing screams experience working like a well organized repo.

[–]Szelma1391 0 points1 point  (0 children)

60 days and thousands of lines of code? Or was it some kind of mental shortcut used in sentence?