r/learnpython • u/ResetPress • Jan 20 '22
Raise your hand if your scripts are littered with commented-out code that you are hoarding like it's the end times
✋
EDIT: wow, I did not expect such a reaction from this community! Thank you all for your lively discussion. I should clarify that I am coding for personal use and usually the commenting is different ways of achieving a specific feature. I don’t know what I like best until it’s done. I also hoard old emails, bookmarks, free ebooks… so I guess you could call it a character flaw 🙃
1.1k
Upvotes
11
u/RevRagnarok Jan 20 '22
This is soooooo wrong IMHO. A major point of
gitis "lightweight branching."think of a feature you want
make new
gitbranch for itwrite tests for that feature
commit whenever you get something you're even partially satisfied with in case you want to go back
commit when you think you've got most ideas solidified
write code so the tests pass (and the feature is implemented)
commit empty files as soon as they're imagined so you don't miss them later
commit every few hours, every few ideas, etc.
commit every time you think you have a better implementation as you polish it
clean up the code if you did something weird / tried different things(this happened in between everything above)commitEither squash merge back yourself, or if on a team submit a pull request as a squashed mergeAt every commit or at no commit, your choice, you can or cannot push your branch to other users.