Hey everyone! I need some guidance on the right way to handle Git commits for projects I want to showcase on my resume. I usually work on both a desktop and a laptop, and when I'm just learning something in a private repo, I commit randomly whenever I'm switching machines without thinking much about it.
However, I'm more concerned about how to manage my commits for projects that I want to display.
1. If I'm in the middle of implementing a feature and have to leave, should I still commit even if things aren't working? What should I write in the commit message? I wouldn't normally commit if I were continuing on the same machine.
2. I'm also learning while I code, and I know I won't always get it right on the first try. If I commit code I know is incorrect but want to keep track for educational purposes, will that hurt my commit history? How should I approach this?
2 Answers
To keep your commit history neat, it's best to work on a feature branch and only merge into the main branch once everything is complete. When you do merge, consider squashing your commits into one with a clear description. If you accidentally introduce a bug, you can easily revert or add a new commit to fix it; it's really not a big deal.
Using Pull Requests and squashing your commits can help maintain a clean commit history. But honestly, most employers probably won’t even look at your commit history in detail, so just do what feels right for you.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically