{"id":632,"date":"2023-01-05T22:11:07","date_gmt":"2023-01-05T21:11:07","guid":{"rendered":"https:\/\/mic.st\/blog\/?p=632"},"modified":"2023-05-15T21:32:17","modified_gmt":"2023-05-15T19:32:17","slug":"how-to-remind-myself-of-where-i-stopped-coding-yesterday-micro-commits","status":"publish","type":"post","link":"https:\/\/mic.st\/blog\/how-to-remind-myself-of-where-i-stopped-coding-yesterday-micro-commits\/","title":{"rendered":"Micro-commits and how to continue where you left"},"content":{"rendered":"\n<p>You should finalize your day with a building project. At least I like to do that. Often you need more than a day to finish some larger task. Also, if you are getting headaches, it&#8217;s totally fine to stop coding for the day (and you probably really should). Still, it would be nice to know the next day where you left.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Tip<\/h2>\n\n\n\n<p><strong>Here is the quick tip:<\/strong> If you want to continue working on some problem you were not able to solve the day before, just add something that won&#8217;t compile near that place. Next day trying to build the project will just fail at this point!<\/p>\n\n\n\n<p>This saves you from having post-its, notes etc. You see right in the code where you left.<\/p>\n\n\n\n<p>I&#8217;m doing that all the time when I get headaches in the evening and I feel it&#8217;s better to do something else and come back the next day.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Also: Micro commits<\/h2>\n\n\n\n<p>Besides that, (it&#8217;s a slightly different topic but still really important) always consider doing micro commits instead of having a dangling-in-the-air working copy for a long time.<\/p>\n\n\n\n<p>What are micro commits? You can read about it here in more detail: <a href=\"https:\/\/world.hey.com\/niko.heikkila\/a-practical-guide-to-micro-commits-a37151eb\" target=\"_blank\" rel=\"noopener\">https:\/\/world.hey.com\/niko.heikkila\/a-practical-guide-to-micro-commits-a37151eb<\/a> or <a href=\"https:\/\/www.industriallogic.com\/blog\/whats-this-about-micro-commits\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.industriallogic.com\/blog\/whats-this-about-micro-commits\/<\/a>.<\/p>\n\n\n\n<p>Basically, you should just commit any small step on your branch that builds. Some advantages of it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can easily roll back stuff and see when stuff started to break.<\/li>\n\n\n\n<li>Your coworkers can help you out \/ take over if you are not able to work on it (e.g. because of sickness, quitting, whatever)<\/li>\n\n\n\n<li>If your machine or setup suddenly breaks you still have all your changes on remote<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Instead of wasting post-its, sprinkle around <code>\/\/ TODO<\/code> comments regarding stuff you want to refactor \/ fix or whatever the next day, just add some plain text inside your code that won&#8217;t compile. The next day your build will just stop there!<\/p>\n\n\n\n<p>Do commit as often as possible whenever you changed something that builds. I sometimes see people trying to cram everything in one large commit. Some people like to <code>git commit --amend<\/code> all the time to have one or a handful of huge commits in the end. (see here if you did never hear of the command: <a href=\"https:\/\/www.atlassian.com\/git\/tutorials\/rewriting-history\" target=\"_blank\" rel=\"noopener\">https:\/\/www.atlassian.com\/git\/tutorials\/rewriting-history<\/a>). This is fine as long as you still do often commit. Still, you loose your separate checkpoints each commits represents by doing that. Therefore, personally I try to never do that for completely different commits.<\/p>\n\n\n\n<p>However, the most dangerous behavior is to just not commit anything until everything is finished (having only a local working copy). It&#8217;s not healthy for you and also it&#8217;s really bad practice in a team setup. For example, nobody can quickly jump on your feature branch and try to help you if help is needed at some point. In general, it&#8217;s really easy to f&#8217; up and loose days of work by continuously working on never committed local working copies.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You should finalize your day with a building project. At least I like to do that. Often you need more than a day to finish some larger task. Also, if you are getting headaches, it&#8217;s totally fine to stop coding for the day (and you probably really should). Still, it would be nice to know&hellip;<\/p>\n","protected":false},"author":1,"featured_media":684,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[3,49],"tags":[50,52,51],"class_list":["post-632","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios-development","category-git","tag-git","tag-good-practice","tag-micro-commits"],"_links":{"self":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/comments?post=632"}],"version-history":[{"count":10,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/632\/revisions"}],"predecessor-version":[{"id":732,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/632\/revisions\/732"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/media\/684"}],"wp:attachment":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/media?parent=632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/categories?post=632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/tags?post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}