3 ms·
Non-compiling intermediate commits is basically the normal workflow for most people I've reviewed, unless they're rewriting history. One commit will do somethin
by AlotOfReading 3y ago
Non-compiling intermediate commits is basically the normal workflow for most people I've reviewed, unless they're rewriting history. One commit will do something like refactor an interface, the next will modify a distinct subset of callers, etc. Sometimes those intermediates don't compile for any number of reasons. I'll personally rewrite history for teams that want clean commits, but definitely not universally.
How do you develop that you don't have broken intermediate working states or thoughts that you can't complete by the end of the day?
- NoahKAndrews 3y agoI commit a WIP commit, and amend it the next day
- basil-rash 3y agoYou in fact do not need to commit at the end of the day. You can just… wait until the work is done.
- yarg 3y agoOr, just create a feature branch, commit as you go, squashing before you merge.
- AlotOfReading 3y agoYou can wait, but why would you? Your intermediate work doesn't have to be clean and it's occasionally nice to have a "reset everything to this morning" button without digging into reflog.
- basil-rash 3y agoHow would reflog help without a ref having been created? And I just don’t know what’s special about “this morning” in your sentence. If theres some important intermediary state you’d like to keep track of, by all means commit it. But to commit just because the day has ended is odd to me.
- AlotOfReading 3y agoGoing to blame sleep deprivation for that one. Took your comment to realize reflog wouldn't help. To give a recent example, I was fixing a cryptographic function and had a bunch of constraints in my head. Dumped that into comments and didn't read them carefully enough the next morning. Immediately wrote a change that subtly broke one of those constraints. Having a restore point was helpful. Similarly, I can also say "this experiment I've been pursuing for a couple days went off-track, let's reset and take advantage of hindsight". It's not something I use frequently, but it's convenient and free.
- kevincox 3y agoOften times I will "have to" commit WIP work to check out another branch (to test something, code review, urgent bug fix...). The other main option would be start but it isn't as organized as branches. I guess work trees would also work if they is your workflow. But I would amend these WIP commits rather than just leaving them as they happen to occur.
- basil-rash 3y agoThere’s always ‘stash’ too.
- kevincox 3y agoThat is what I meant, typo + phone seems to have resulted in "start". The problem for me is that stashes aren't associated with a branch and I find them very hard to manage. I end up just using stash for very temporary things (like moving code to a different branch). Once something has been stashed for more than 10min I basically forget it exists.