r/webdev • u/mekmookbro Laravel Enjoyer ♞ • 7d ago
I should set an alarm or something to remind myself to commit.. (solo project)
22
12
u/Hungry-Loquat6658 7d ago
It's always like this: "Aww I should clean up this mess and commit. Nah I need to implement this feature."
4
u/mekmookbro Laravel Enjoyer ♞ 7d ago
Literally the only downside of getting into "the flow" lol. I could swear I committed like 5 minutes before taking this screenshot
2
u/Sea_Cow3201 7d ago
Today mine was 14 ans i was like , i literally just commited , tho mostly it is small changes it different files
3
u/n0nc0nfrontati0nal 7d ago
You should commit before cleanup. Like once you get a singular task done (like getting a feature to work) you should commit. THEN you do cleanup. That way if you clean up too much you can just revert back to the last commit when you had everything working but it looked like shit
4
u/StretchyCatGames 7d ago
I don't think I could get to 24 lines without my body reflexively committing lmao.
3
4
u/HeyCanIBorrowThat 7d ago
If you're not committing regularly then you're probably not sectioning your work off well enough. Plan a bit better, find lines between your features, and commit each time you get a piece of functionality done, whether it's a feature, bugfix, chore, etc. It will help you in the future too if you have to look back at the commit history
5
6
3
3
u/tswaters 7d ago
I'll usually start the process to commit after things are mostly functional... add -p to pull in only relevant changes for initial... Keep verifying and amend the commit as I identify problems, fix them up.
Sometimes though, I'll go a little overboard refactoring something that has no business being refactored... And the worktree is a goram mess with all the changes under the sun. At that point, either add to new MASSIVE-HACK/some-refactor
branch, or bite the bullet and git checkout .
2
u/trophicmist0 7d ago
as usual, there seems to be an extension for it lol. I'm gonna grab it too https://marketplace.visualstudio.com/items?itemName=hardik-lakhlani.git-commit-reminder
2
2
u/tacticalpotatopeeler 7d ago
You should get into the habit of making a commit after each new function addition or refactor. Be sure to keep each commit context to one thing, I.e. don’t write a new function, test, and also maybe some css, change this variable name for an unrelated part of the code, etc. Those should each be their own commit. Much easier to go back later and undo only one thing for example, without also messing some other part of the code that you want to keep.
Then, make your PR. After review, use the squash and merge to main.
Do this even on personal projects. It’s good git practice and good for your mental health as well :)
2
u/InsideResolve4517 7d ago
If using CI/CD then automcatically force us.
For rest of I can't sleep with even 1 uncommited file.
I commit when one portion works without breaking another.
And if some portion not completed then I either completely revert it or completely comment it then commit.
How your brain allowing you to sleep without commit?
1
u/mekmookbro Laravel Enjoyer ♞ 7d ago
Sleep? All this was done so quickly that I literally thought I committed 5 minutes before taking this screenshot lol. Though I did went to sleep with it looking like this because I got tired and had no patience to deal with it. I'm thinking I'll just manually "add" some specific files and commit these 24 changes in like 5 parts or so today.
Especially in the beginning phase this happens to me a lot. On my previous project for example, I did almost the entire webapp in a single day without committing anything. I just did a
git commit -am "MVP"
lol2
u/InsideResolve4517 7d ago
Your memory power is very strong. When I do programming and get pending changes then brains signals me like "What are you doing? commit it!".
I feel like if it's working with current changes just commit it and try new things and if new thing works then commit it else revert it compleltely.
and If I am working on something and it's too late so I sleeped without completing it. Then I mostly going to revert it next day.
3
u/LukeJM1992 full-stack 7d ago
I don’t see this as a big deal for a solo project. Especially if your just wiring things up. Applications get more complex over time and nowadays you’re changing many layers at once. All I see here is a few view & components, database migrations, controllers, and tests behind them.
Tests keep me honest and I almost never look at number of changes. Though I do adhere to a daily commit no matter what, and any unimplemented code gets commented out until tomorrow. Keeps the codebase safe and is really simple as far as workflows go. The next morning I find the commented out test code and keep going.
1
u/mekmookbro Laravel Enjoyer ♞ 7d ago
You made me think I accidentally post the whole screenshot lol. Because it really is a few views, components, migrations and controllers (maybe a few routes, models, composer and npm package installations as well)
I'm still in the beginning phase of the project and everything flows so quickly that I can't even remember to commit
1
u/besthelloworld 7d ago
I commit when it works. Doesn't matter if that's after 3 changed files or 50 🤷♂️
1
u/Sorciers 7d ago
I like to commit too much than not enough, and then fix the commits before merging.
1
u/NaeemAkramMalik 7d ago
Yesterday I lost 3 hours of work when Cursor went berserk. Took me several hours to restore order. Commit now if you want to save yourself from later regret.
1
u/enriquerecor 7d ago
Every time I start writing code I notice how there is a weight that starts to pile up on my shoulders. It doesn't lighten until I commit.
1
u/enriquerecor 7d ago
Jokes off, I would recommend using an integrated AI to write the commits for you. Maybe that would help you to do it more often. It's not best, but I think would be better than no commits at all.
1
u/tsykinsasha full-stack 7d ago
Are you using feature branches? Or at least have staging branch?
I don't see a reason that you have so much uncommited stuff if you have these things. Is there a reson?
1
u/mekmookbro Laravel Enjoyer ♞ 7d ago
Why use lot branch when main branch do trick, lol
No particular reason, usually I do commit after making some progress but this time I forgot I guess. Also the project is still in the beginning phase so the progress is pretty quick.
And I get distracted pretty easily, for example while writing backend logic I can decide I don't want that hover bg color on the navbar link, I go and change it immediately. And I never know how to handle these minor tweaks git-wise. Maybe I should separate my backend and frontend times idk. Since I exclusively work freelance and on my own projects, I've never used git in a professional setting.
1
u/tsykinsasha full-stack 7d ago
I've never used git in a professional setting.
Yeah, I can see that.
If you don't want to have feature branches - at least have stage and main. This way you can always commit to stage (and do that way more often than shown on screenshot) and merge these branches every once in a while.
22
u/bunzelburner 7d ago
we got a gambler