5 ms·
curl ... >> .git/hooks/pre-commit Append instead
by delinka 10y ago
curl ... >> .git/hooks/pre-commit
Append instead
- avar 10y agoThat's horrible advice. The existing .git/hooks/pre-commit may not even be a shellscript, you could be appending to a binary file. Even if it's a shellscript you can't just concatenate shellscripts together and expect them to work as thought you'd run them as two independent shellscripts.
- delinka 10y agoPresumably, one's git hooks are not in danger of being lost to oblivion. If that's the case, neither bit of advice is ideal. If, however, one is careless enough that unix plumbing with obliterate the hook for eternity, then appending at least allows the original to exist some place.