Complete guide to GitHooks - Creating your own pre-commit hooks

Поделиться
HTML-код
  • Опубликовано: 9 май 2023
  • GitHooks are a great way of automating tasks and checking information while using git. These hooks are both powerful surprisingly easy to create yourself. In this video tutorial we run through how git hooks work and how to create both local and global git hooks which can call an API, use grep to find keys and even call other local tools.
    Links:
    GgShield: github.com/GitGuardian/ggshield
    Learn more at
    pre-commit framework: pre-commit.com/
    Git Hooks.com githooks.com
  • НаукаНаука

Комментарии • 23

  • @mistymu8154
    @mistymu8154 8 месяцев назад +10

    Great video. Just a quick aside, by default, VS Code hides the .git folder so needed to add the following to my settings:
    "files.exclude": {
    "**/.git": false
    }

  • @MrUmban
    @MrUmban 4 месяца назад

    Amazing explanation. Thank you!

  • @bactran7799
    @bactran7799 8 месяцев назад +1

    your video is really valuable to me. Thanks a lot

  • @mirosawkodzinski9779
    @mirosawkodzinski9779 8 месяцев назад +1

    Great tutorial., explains a lot.

  • @jaysharma3504
    @jaysharma3504 9 месяцев назад +2

    Great video dude! Do post on pre-commit framework when you can. Looking forward to it!

    • @GitGuardian
      @GitGuardian  3 месяца назад

      Working on the new video now!

  • @kamyarghanbarpour764
    @kamyarghanbarpour764 15 дней назад +1

    Thanks a lot

  • @raypenha2572
    @raypenha2572 Год назад

    Congratulations for the vídeo

  • @sanjayaelvitigala3086
    @sanjayaelvitigala3086 6 месяцев назад +1

    nicely explained.

    • @GitGuardian
      @GitGuardian  5 месяцев назад

      Thanks for y7our feedback

  • @roboman3418
    @roboman3418 3 месяца назад

    thanks!

  • @clusterdriven
    @clusterdriven 6 месяцев назад +1

    Great video. Thank you for this. Me personally, I prefer the approach of creating a wrapper for git, so that i can say:
    commit "message here"
    and it automatically adds everything + does any other checks such as linting or tests before commits. This also provides the benefit of a syntax that fits your needs. But thank you for the content

    • @GitGuardian
      @GitGuardian  5 месяцев назад

      Another good option, perhaps a little more advanced than a git hook. Maybe worth a vedio on this method

    • @clusterdriven
      @clusterdriven 5 месяцев назад

      @@GitGuardian Right. It does not need to be super advanced. In my case, for example, I simply add this to my .bashrc:
      # Automatically stage all, commit, and push in one command
      function commit() {
      if [ -z "$1" ]; then
      echo "Please provide a commit message."
      return 1
      fi
      git add .
      git commit -m "$1"
      push
      }
      the above automatically adds all changes to staging, commits with a given message, and pushes. Of course you can customize it to your needs. But the above is a simple bash function.

    • @clusterdriven
      @clusterdriven 5 месяцев назад

      the "push" is because I also have the following alias:
      # Using push will resolve to git push origin $(current_branch)
      function push() {
      git push origin $(git symbolic-ref --short HEAD)
      }

  • @eswarm1234
    @eswarm1234 3 месяца назад

    Please do a video on pre-commit framework

  • @test-em3re
    @test-em3re Месяц назад

    will this work on GitHub desktop ?

  • @larsvagt1340
    @larsvagt1340 2 месяца назад

    Basically cool explanation. Unfortunately I cannot give to my dev team due to the joke. One of the devs is a dad who experience a similar thing at school and it would really hurt him. :(

  • @anshuldishoriya2992
    @anshuldishoriya2992 2 месяца назад +1

    nicely explained.