6

TL:DR; Shall I start comitting regularly small pieces of code in new projects? Even if I'm start from scratch and don't have any experience in what I'm using (framework, programming language, w/e)?

Whenever I've learned something new for myself I did not have commited anything in an early stage. For several reason: Basically beacuse I've no idea what I'm doing and don't know any best practices yet etc. So I just start and try things and rewrite them for like 100 times (at least it always feels like that).

Yet I've got a new job and I'm starting a new complete project in AngularJS with Spring Boot backend. I'm mainly working on the frontend. I'm pretty new to Angular and JS in general. At this moment I'm the only one commiting to the project. The initial commit was like yo jhipster (this set's up a complete app skeleton that is ready to run) and some custom database mappings.

My first commit was like

Implemented controller X 

Sorry for large comment I've just started with Angular. [...]

Since I don't have the time to learn things in a sample project and there is a very short deadline for a first presentation I feel like it's better to have some bigger commits. I'll try to keep commits at least related to one topic. Like

Integrated template X into project

Replaced this with that and [...]

Anyway - this commit will be huge. Unlikely that someone will check the whole diff.

I'm working on a seperate local branch themeIntegration. I'll do there smaller commits that are actually just to have some commits where I can fallback if something goes absolutely wrong or I just recognize I've did probably something wrong I'll change a lot now. I'll squash merge it into my develop branch later.

1 Answers1

19

You should commit often.

But @durron597! I'm a beginner programmer! I don't trust my commits!

This is why you are committing on a separate branch!

You can even have many branches that you're committing to for your own use, for different fits and starts and experiments and whatnot.

Don't worry about big fancy commit messages. The only commit messages that really matter are the ones that occur when you finally attempt to merge your changes into trunk. At that time, go through your whole list of smaller commit messages and aggregate them into something someone else will read. In the meantime, your commit messages are only for you, and having a big commit history can only help you to track down problems if you make a mistake.

durron597
  • 7,610
  • 10
  • 39
  • 67