Improve your Git commits using patch mode
neowork.com
neowork.com
(even if they are in a feature branch, broken commits will break `git bisect` unless the branch is folded when merged)
This lets you create multiple commits at the same time and run tests on all of them. You could argue that committing and resetting is effectively the same thing as stashing and popping, but I think the benefits of being able to iterate over a list of commits and test each one is worth creating additional commits that you will probably reset shortly after testing.
This is also what you should do after a rebase to test all affected commits as they have not neccesarily existed in a testable state in the work tree.
[1] https://github.com/garybernhardt/dotfiles/blob/master/bin/ru...
> without stashing everything else
and noted that if you're going to stash the rest either way you could just as well use `stash -p` in the first place.
There's a difference between `stash -p` and `add -p + stash`, though. If you want to split your changes into more than two commits, you have to use add/commit/add/commit because stash will just make a commit with "what's left" (it's subtractive operation).
skip is necessary when your history is broken and fucked, but I'd just as well not have a broken and fucked history in the first place.
No, if your script exits with exit code 125, then that means "skip". You just need to write a wrapper script that'll handle that, so "make || exit 125 ; ./test-if-commit-is-good.sh" can do it.
Side hint: for things like fixing typos, I found that creating a new branch, say 'typos', is quite handy solution to not do these kind of things in the commits that are meant to add new things / fix bugs. Just checkout typos, fix, commit, checkout master / feature branch.
Could you maybe elaborate on this a little bit more? I don't think I quite understand this.
My understanding is that you'd have to do a 'git merge master' after you checkout 'typos', make the fix, commit, and then a 'git merge typos' after you checkout 'master'. Then wouldn't this add all of the typos commits into the master branch anyway?
I'm very likely missing something fundamental. (Perhaps my source control habits aren't up to snuff.)
It creates commits with a special name that will be recognized `git rebase -i --autosquash`. It will merge commits with their fixups (+ whatever you want to do with `rebase -i`).
This, from what I understand this will take effect only if you introduced a typo recently and then you rebase so that the typo-containing commit is included in the rebase. Nevertheless, it sounds interesting.