3 ms·
How might a commit-first Git workflow look? I'm imagining a lot more use of squash/fixup and the like than sounds fun.
by harlanlewis 14y ago
How might a commit-first Git workflow look? I'm imagining a lot more use of squash/fixup and the like than sounds fun.
- walle_ 14y agoI made a simple proof of concept of the workflow. https://github.com/walle/git-cdd https://github.com/walle/git-cdd
- tosbourn 14y agoI would imagine the amount of commits might actually shrink, because there is more focus to each commit.
- elviejo 14y agoIn Code Complete McConnell writes an example in which he writes the main ideas of how his code will work as comments in an empty file. so maybe one would go on write this comments, commit them as the 'How', and then in the first commit message write the 'What'? then do the first commit and continue from there.... making the 'How' work
- kenmazy 14y agoUsually I write a little code, commit what it is supposed to do, then fixup all the little edge cases and bugs that come naturally. But what's important is that first commit is sets up a little problem with a clear goal, and then everything afterwards works toward that goal. Two extremely useful aliases: [alias] fi = !sh -c 'git commit -m \"fixup! $(git log -1 --format='\\''%s'\\'' $@)\"' - ri = rebase --interactive --autosquash First alias allows me to create a commit prefixed with fixup! very easily. So workflow looks like this: 2536aw3 implementing feature foo sfd93ja fixup! implementing feature foo ok4jzvd fixup! implementing feature foo k4okvxx fixup! implementing feature foo 2okoswa fixup! implementing feature foo zxvorm3 fixup! implementing feature foo ko2koaa fixup! implementing feature foo And then I rebase when git log --graph --pretty goes off the screen.