To manually clean up whitespace from your last 3 commits, you can do this:
git rebase --whitespace=fix HEAD~3
When I work on a topic branch, I track the upstream branch (usually by creating it like this)
git checkout -b topic -t
Which allows me to drop the last argument from git rebase
. So once I'm done & ready to merge, I can clean the whole topic branch quickly with:
git ws
# aliased to rebase --whitespace=fix
Note that, unlike the HEAD~3 example, this will actually rebase your changes upon the upstream branch if it's changed! (But that's also what I want, in my workflow.)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…