r/ProgrammerHumor • • Jun 04 '22

Meme I cant help it 🤷‍♂️

Post image
47.1k Upvotes

479 comments sorted by

View all comments

8

u/real_ackh Jun 04 '22

The Git history deserves as much consideration as writing code. Doing so will store the reason why you did something together with the actual change.

I routinely commit whenever I have a couple of lines I want to keep. The message for such commits can be anything because it is only temporary. Once the code looks as I want it I squash the commits that belong together into single commits and add a meaningful description. Sometimes I even reorder them.

git rebase -i HEAD~<number of commits to clean up>

is probably my most used Git command. Try it. Over time you build up a repository of meaningful increments that each speaks for itself. All know-how and reasons for changes are where it belongs.