8

Pre commit hooks serve no other purpose than to be annoying.

Comments
  • 6
    Mmmm… false.
  • 17
    Sounds like you might be the reason that hook was set up.
  • 4
    Pre commit hooks are like doing validation in the frontend
  • 4
    @TheLastInteger it saves time since you get the warning before you try to push.
  • 6
    Last guy who I heard say this decided he didn't need to conform to the style guide because "his way" was better.

    Yeah... It wasn't.
  • 3
    I love not being able to commit a because b has 'unused methods', I ONLY WANT TO COMMIT A FFS!
  • 2
    Time for double git mode lol
  • 0
    @ElectroArchiver then do not add b to the commit ;)
  • 2
    @ElectroArchiver Reminds me of my current employer’s doublethink:

    “Use git to back up your work”
    and
    “Don’t commit broken code”
  • 0
    @Voxera I didn't select it to be commited . .
  • 0
  • 2
    @ElectroArchiver Then its a badly created commit hook.
  • 1
    @Voxera Yes, and in my experience, many of them are.
  • 1
    @ElectroArchiver but that does mot mean that the idea of precomit hooks are but, just that most are bad at using them :)

    And yes, that is a good reason to be weary of them and really think about what purpose you want them for.

    They should be as a complement to push validation on the server and to avoid pushing something that will not be accepted anyways.

    We have one that ensures that all commits start with what looks like a jira ticket id since all commits must be in reference to a jira.

    It will not check if its a valid ticket, that is handled by the git server which will reject it if the jira does not exist, but it ensures that you did not forget to add it and that you formatted it in a way the server would understand at least, saving you time, especially if you where to push multiple commits, would be sad if the first was wrong :)
  • 1
    @Voxera Sure, though they should also work,..

    some I have had the pleasure to use didn't work with GitHub Desktop for example,.. fun.
  • 0
    I agree. I wasn't there when they set it up, but no one uses them and they have some arbitrary and stupid rules like "no fullstop at the end of the sentence".
Add Comment