3 ms·
Learning git is the cheapest way to get faster at coding. First get a good grasp of command-line git and of the git workflow (dirty working directory -> staged
by photochemsyn 4y ago
Learning git is the cheapest way to get faster at coding. First get a good grasp of command-line git and of the git workflow (dirty working directory -> staged index -> commit code), and then use git diff to see how your code changes from one commit to the next (or between the staged index and the previous commit, or just looking at one file, etc.)
If you get your git diffs from one commit to the next to start looking concise and clear, maybe one working function added per commit, one block, one small class etc,, then you can start coding pretty quickly, because you're adding in discrete chunks, testing as you go, and you don't get lost trying to do too much at once, you can quickly switch back to the latest working version, debuggging is much faster, etc.
- culi 4y agoVS Code makes visualizing diffs extremely easy. You can also select specific lines and commit them as you want. This enables a workflow I love to use for smaller PRs where I just do all the work without making any commits and then at the end of it all I walk through my changes and group/organize the changes however makes the most sense
- agentwiggles 4y agoI do this too, although I definitely make commits along the way. Then at the end I rebase and batch things up. My in progress commits are usually just things like "works here" or whatever. I truly love having git backing me up as I play with code - it's a superpower that basically no other field has access to. (imagine if you could drop a commit before you make that circular saw cut and revert when it went off, or revert the splotch of paint you got on the ceiling! ) The mindset has even become part of how I play Factorio, I have dozens of save files like "pre big train refactor" and similar.
- usrbinbash 4y ago> You can also select specific lines and commit them as you want. You can do that on the command line as well; git add -p