Y tho??? Holy shit. Commits should be like functions. One thing and one thing only. Maybe a small group of files like the same change over multiple config files. 50 is insane to me.
Every time I commit I have to look through git diff, figure out what the hell I actually did, come up with something intelligent to say about jt, possibly split the commit into multiple commits if I changed multiple things, do some shuffling with git reset and git add...
For some reason all my personal projects are all like 4K SLoC with 50 total commits, all of which include apologies for not doing more smaller commits
You see, sometimes I code something, go to bed before finishing it, come back, decide not to commit because then I'd have to think of a commit message and I just want to code, start working on an unrelated feature, do that for a couple days, get distracted by life stuff and put the project down for a few weeks/months, rinse and repeat, and then I finally get around to writing a commit message because I'm about to start a huge change and I want a restore point and I'm like. Okay, it's been like 3 months since my last commit, I'm pretty sure my code can now do something it couldn't 3 months ago but come on, I can't even remember what I had for lunch last Thursday
I'm well aware this is terrible practice but I don't know how to stop doing it
I just get too excited about actually implementing/fixing something (random things that I see along the way) more than commit ceremony (nobody will care about it in my project anyway other than one random guy who gave the repo a star)
I spend much time splitting them up inside visual studio by file and individual lines changed to try and separate my many simultaneous changes into several somewhat usable commits. If I was stupid enough to make some big refactor at the same time I might just have to throw in the towel... It's really painful after a few weeks to try and pick up the pieces of what I was doing but never commited too lol.
"patch mode" - Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history.
I was being more evil than that, saying that if one is gonna push direct to main, might as well maximize the possible damage to everyone else's branch.
I think it depends what branch your local version of the repo is set to. If you're already in master then it'll push there, if you're in a testing branch then you can push it straight to master instead by telling it to
For me, it was my boss gave me a programming task which he knew would take hours or a day or two... and then 15 minutes later tells me to "switch focus" and do a menial task that any of my five coworkers could do 🤦♂️
Don't just summarize the content though, summarize the rationale or how things connect. I can read your diff myself to see what changed, I want to know the logical connections, the reason you did X and not Y, etc.
Or just say "stuff" and provide that context in the PR description separately, no need to overdo the commit log on a feature branch if you're using squash merges from your PR.
Oh god I feel so called out. I wish I paid more attention to my commit messages but I’m usually too busy fixing the directory structure and refactoring. Sigh.
Master should just have the feature description commits, not the hundred commits it took to get there after refactoring the code for the 3rd time and pulling changes from master since it's taken so long to get done.
Yeah I worked at a place like that, but it made sense because we were also expected to keep PRs small, so a good commit message for several squashed ones was perfectly fine.
I prefer that approach. We work with smaller tasks, so it makea more sense, plus it helps keep the master clean and if you want a more detailed view of the specific commits, you just have to click on the link to the PR. It's a better way to organise it IMO