3 ms·
> And when I have to work with them, I really would prefer if git had something like `git save`. Which in the backend kept doing something like `git commit -a -
by xyzzy_plugh 9y ago
> And when I have to work with them, I really would prefer if git had something like `git save`. Which in the backend kept doing something like `git commit -a --amend`.
This works fine, but it encourages squashing all your changes into a single commit, rater than providing you the opportunity to build a series of commits.
Instead of `git commit -a` I have gotten into the habit of `git add -p` followed by `git commit` and breaking up my current WIP changes into themed-commits. Then later, I perform an interactive rebase and clean up my series (reorder, squash, reword, edit, etc.).
I think, as you and others in this thread describe, the pain is that forming these lightweight commits is cognitively expensive -- but like all things, with experience and practice it becomes nothing at all.
- cjhanks 9y ago> I think, as you and others in this thread describe, the pain is that forming these lightweight commits is cognitively expensive -- but like all things, with experience and practice it becomes nothing at all. A person can only control their own behavior. :)
- __david__ 9y agoYou can disable pushes to the master branch and (politely) refuse to merge bad commits. Bad when I used darcs we used to give everyone permission to push to the main repo, but we'd aggressively unpull patches from the server that were bad.
- keeperofdakeys 9y agoIf you use `git commit --fixup=<commit>`, then the new commit will be automatically moved, and given the "fixup" action when doing an interactive rebase. (Same for --squash). This means you only need to match the fixups to commits once, when you're initially creating them.
- xyzzy_plugh 9y agoYes, but I rarely use this as I often haven't made up my mind regarding how the series should be structured. If instead I could fixup using a tag or theme identifier, which would be used to reorder and group commits, then I would spend less time in my rebase.