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

  Рет қаралды 24,893

GitGuardian

GitGuardian

Күн бұрын

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/Git...
Learn more at
pre-commit framework: pre-commit.com/
Git Hooks.com githooks.com

Пікірлер: 23
@mistymu8154
@mistymu8154 11 ай бұрын
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 }
@jaysharma3504
@jaysharma3504 Жыл бұрын
Great video dude! Do post on pre-commit framework when you can. Looking forward to it!
@GitGuardian
@GitGuardian 5 ай бұрын
Working on the new video now!
@MrUmban
@MrUmban 6 ай бұрын
Amazing explanation. Thank you!
@bactran7799
@bactran7799 11 ай бұрын
your video is really valuable to me. Thanks a lot
@mirosawkodzinski9779
@mirosawkodzinski9779 11 ай бұрын
Great tutorial., explains a lot.
@anshuldishoriya2992
@anshuldishoriya2992 4 ай бұрын
nicely explained.
@GitGuardian
@GitGuardian 2 ай бұрын
Thanks for liking
@kamyarghanbarpour764
@kamyarghanbarpour764 2 ай бұрын
Thanks a lot
@GitGuardian
@GitGuardian 2 ай бұрын
Most welcome
@raypenha2572
@raypenha2572 Жыл бұрын
Congratulations for the vídeo
@roboman3418
@roboman3418 5 ай бұрын
thanks!
@eswarm1234
@eswarm1234 5 ай бұрын
Please do a video on pre-commit framework
@GitGuardian
@GitGuardian 5 ай бұрын
Sure thing @eswarm1234
@clusterdriven
@clusterdriven 8 ай бұрын
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 8 ай бұрын
Another good option, perhaps a little more advanced than a git hook. Maybe worth a vedio on this method
@clusterdriven
@clusterdriven 8 ай бұрын
@@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 8 ай бұрын
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) }
@test-em3re
@test-em3re 3 ай бұрын
will this work on GitHub desktop ?
@larsvagt1340
@larsvagt1340 4 ай бұрын
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. :(
@sanjayaelvitigala3086
@sanjayaelvitigala3086 8 ай бұрын
nicely explained.
@GitGuardian
@GitGuardian 8 ай бұрын
Thanks for y7our feedback
Store & manage secrets like API keys in Python - Tech Tip Tuesdays
12:46
How Git Works: Explained in 4 Minutes
4:18
ByteByteGo
Рет қаралды 209 М.
Touching Act of Kindness Brings Hope to the Homeless #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 20 МЛН
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 91 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 13 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1,1 МЛН
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 1,1 МЛН
Git hooks, practical uses (yes, even on Windows)
13:36
tygertec
Рет қаралды 62 М.
What are GitHooks? Explained in 5 minutes
6:07
GitGuardian
Рет қаралды 4,8 М.
13 Advanced (but useful) Git Techniques and Shortcuts
8:07
Fireship
Рет қаралды 915 М.
How to be a git expert
46:26
Floating Little Leaves of Code
Рет қаралды 161 М.
Automated testing using GitHub Actions... easier than I thought
24:29
Github Mistakes and What I Wish I Knew Sooner
16:47
Chris Titus Tech
Рет қаралды 35 М.
Touching Act of Kindness Brings Hope to the Homeless #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 20 МЛН