this post was submitted on 18 Aug 2023
2 points (100.0% liked)
Programming
17432 readers
225 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
git add -p
is great to know, but IMO one shouldn't rely on it too much, because one should strive committing early and often (which eliminates the need for that command). Also usinggit add -p
has the risk of accidentally not adding some code that actually belongs to the change you are trying to commit. That has happened to me sometimes in the past and only later do I see that the changes I commited are broken because I excluded some code that I thought didn't belong to that feature.There are other reasons to use it. A major one is doing a “code review” of changes before committing, or even deciding to drop a chunk of code from a commit entirely (like a debug statement that no longer is necessary.)
I’m all about frequent commits (and right-sized commits), but the functionality can still be beneficial even in those scenarios.
I also don’t care if I have a broken commit. This turns up very quickly, and there is zero expectation that feature branches are always in a working/stable state. The expectation is that pending work gets off the local machine on a regular interval.