Git Confirm

Dev tools

git hook

SHOW HN2016

Git Confirm

Git Confirm. Git hook to catch accidentally committed code (TODO/Skip)

github.com

#git hook#pre-commit#git add -p#accidental commit

51points
45comments
#729of 2,264 in 2016
Top 33%of 2016 by points

How HN took it

DebatedReal support and real criticism

4 positive, 5 neutral or asking, 0 mixed, 3 critical, out of 12 comments about the project. Thread score +0.08.

Idea: 4 for, 3 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Useful for catching unrelated or temporary changes before commit

    From 2 comments
    • There isn't a lot that peeves me more than working with developers with poor git commit habits. As someone who takes every commit they make seriously, it can really…
      themckman on HN
    • Same. Last project I worked on, most people used git add ., git commit, without ever looking at what was staged. The peeves were real. I'd love a tool that didn't let you commit…
      nathancahill on HN
  • Overcommit is a good alternative for managing hooks

    From 1 comment
    • https://github.com/brigade/overcommit It's wonderful.
      dpcx on HN

Objections

  • Copying hook via curl into .git/hooks could clobber existing hooks

    From 1 comment
    • ``` curl https://.../hook.sh > .git/hooks/pre-commit ``` This seems like a bad idea, since you may already have a commit hook that this would clobber. Does anyone use any kind of…
      web007 on HN
  • Developers can bypass it with -n or empty messages

    From 2 comments
    • It's a good idea but ultimately the people who don't care about this will start doing: git commit -am "" /y
      throwawayReply on HN
    • Don't forget -n (--no-verify). The last thing we need is some automated test suite getting in our way ;)
      happyslobro on HN

Requests

  • Support for matching AWS access key patterns by default

    From 1 comment
    • ``` git config --add hooks.confirm.match "AKIA" ``` would probably be a good default for AWS users.
      john_oshea on HN
  • Learn from project history to flag unrelated files

    From 1 comment
    • There isn't a lot that peeves me more than working with developers with poor git commit habits. As someone who takes every commit they make seriously, it can really…
      themckman on HN

Questions

  • How to handle hook plugin management

    From 1 comment
    • ``` curl https://.../hook.sh > .git/hooks/pre-commit ``` This seems like a bad idea, since you may already have a commit hook that this would clobber. Does anyone use any kind of…
      web007 on HN

Alternatives named

  • overcommit

    From 2 comments
    • ``` curl https://.../hook.sh > .git/hooks/pre-commit ``` This seems like a bad idea, since you may already have a commit hook that this would clobber. Does anyone use any kind of…
      web007 on HN
    • https://github.com/brigade/overcommit It's wonderful.
      dpcx on HN
  • git add -p

    From 1 comment
  • git commit -v

    From 1 comment
    • This looks pretty similar to `git commit -v` which brings up a diff of changes in a text editor and prompts you for a commit message.
      jdoliner on HN
  • GUI clients like SourceTree

    From 2 comments
    • Honestly I think the best thing you can do towards making good commits is having a good GUI client and using it well. What I do is, after I'm done making a mess of things, I…
      boardwaalk on HN
    • I agree, some time ago I wrote down why I liked GUIs and this was the main point. A relevant part is: ``` This also means that for every commit, you ‘must’ skim through each file…
      wingerlang on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/12218622)