[Vm-dev] git-hook considered harmfull!
nicolas.cellier.aka.nice at gmail.com
Sat Dec 29 15:28:43 UTC 2018
I'm working a lot with git stash.
This is because while fixing a problem, my analysis lead me thru another
piece of code and other problems that I fix too, and at the end, I have a
bunch of changes.
I don't want to commit each single fix, because they are often partial, not
well ordered and it would mean rewriting history thru git rebase -i which
is OK for not too complex mess, but not that great for interactivity.
It's much much more simple and interactive to have a pool of changes in the
working copy, selectively pick some feature to stage via a good GUI client
(sourceTree works well for me), stash the rest to check if compilation OK,
I even often maintain a stack of stashes for different features.
For example, I have stashed changes for FloatMathPlugin fixes that I want
to be integrated when I compile my own VM, but that I don't want to commit
into another feature branch. since git 2.13 it's as simple as
git stash push -m "FloatMathPluginFix"
That's very lightweight compared to having specific branches for doing the
Oui mais voilà, each time I commit, merge or checkout a new branch, my
latest stash is popped which mean applied when I don't want to, and removed
from my stack of stashes which I ABSOLUTELY do not want to!
More other, when attempting a rebase -i, I often encounter undesired side
This is really annoying/completely disrupting my own workflow.
After searching the root cause on forums, I finally discovered the source
of my problems: .git/hooks/post-checkout same for post-commit post-merge
It performs a git stash (save), checkout/commit/merge, then git stash pop.
Err, except that if there is nothing to save, git stash does nothing, but
still, git stash pop will pop one of my carefully crafted feature stash.
This is exactly as described in an answer to
As suggested in this answer, git stash pop should be perform if AND ONLY IF
git stash save changed the SHA1!
I don't really know how to do that, but would greatly appreciate if the
author of these hooks would help me fixing this mess :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev