All Projects → tep → git-templates

tep / git-templates

Licence: GPL-2.0 license
Templates / Hooks for Your Git Repositories

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to git-templates

zhooks
Display Zsh hook functions and arrays
Stars: ✭ 36 (+20%)
Mutual labels:  zsh, hooks
feathers-shallow-populate
Feathersjs populate relational data
Stars: ✭ 21 (-30%)
Mutual labels:  hooks
use-detect-print
A react hook to detect when a page is being printed
Stars: ✭ 55 (+83.33%)
Mutual labels:  hooks
zsh-config
Faster and enjoyable ZSH (maybe) !!!
Stars: ✭ 64 (+113.33%)
Mutual labels:  zsh
husky-elixir
🐶 Git hooks made easy
Stars: ✭ 47 (+56.67%)
Mutual labels:  hooks
zsh-ls-colors
A zsh library to use LS_COLORS
Stars: ✭ 23 (-23.33%)
Mutual labels:  zsh
scala-basic-skeleton
Starting point if you want to bootstrap a project in Scala
Stars: ✭ 16 (-46.67%)
Mutual labels:  hooks
vscode-react-javascript-snippets
Extension for React/Javascript snippets with search supporting ES7+ and babel features
Stars: ✭ 782 (+2506.67%)
Mutual labels:  hooks
dotfiles
🏠 dotfile configuration for macOS and Linux
Stars: ✭ 37 (+23.33%)
Mutual labels:  zsh
reactjs-player
基于 react hooks 的 video 播放组件,结构简单,代码简洁,扩展方便。
Stars: ✭ 32 (+6.67%)
Mutual labels:  hooks
msfvenom-zsh-completion
zsh completion for msfvenom in Metasploit
Stars: ✭ 42 (+40%)
Mutual labels:  zsh
transition-hook
☄️ An extremely light-weight react transition animation hook which is simpler and easier to use than react-transition-group
Stars: ✭ 250 (+733.33%)
Mutual labels:  hooks
nvm-auto-use.zsh
ZSH plugin to call `nvm use` automatically whenever you enter a directory that contains an `.nvmrc` file with a string telling nvm which node to use
Stars: ✭ 16 (-46.67%)
Mutual labels:  zsh
react-supabase
React Hooks library for Supabase
Stars: ✭ 168 (+460%)
Mutual labels:  hooks
dotfiles
No description or website provided.
Stars: ✭ 12 (-60%)
Mutual labels:  zsh
react-use-observer
Performant react hooks for WebApi Observers, useResizeObserver, useInteractionObserver, useMutationObserver
Stars: ✭ 19 (-36.67%)
Mutual labels:  hooks
react-hook-sticky
react hook sticky
Stars: ✭ 19 (-36.67%)
Mutual labels:  hooks
entangle
Global state management tool for react hooks inspired by RecoilJS and Jotai using proxies.
Stars: ✭ 26 (-13.33%)
Mutual labels:  hooks
tacklebox
🎣React UX components for handling common interactions
Stars: ✭ 15 (-50%)
Mutual labels:  hooks
architectury-api
An intermediary api aimed at easing development of multiplatform mods.
Stars: ✭ 139 (+363.33%)
Mutual labels:  hooks

git-templates

Intro

These are just my personal git hooks -- I provide them here in a feeble attempt to ever so slightly lower the overall entropy of the universe (IOW: I hope they make someone's life a little easier).

Install

To install, do something like:

mkdir -p ~/.git-templates/hooks
cp $PreCommitHookScript ~/.git-templates/hooks/pre-commit
git config --global init.templatedir '~/.git-templates'

Now, all new repos will get a copy of the hook scripts from your template directory.

To install into existing repos, simply copy the appropriate hook script into the repo's .git/hooks directory.

For all the gory details, take a look at https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

Description

Currently there's just one hook script here:

pre-commit -- Never (accidentally) commit an ELF binary ever again!!

On Linux, there's no simple way to globally declare that you want git to ignore every binary file; unlike Windows, there's no conventional filename extension to indicate that a file is executable. To remedy this, I've written a quick-n-dirty pre-commit hook script to detect when/if an executable has accidentally been staged for commit.

NOTE: This hook script won't work on Windows -- but, then again, you don't really need it on Windows, do you.

The included pre-commit hook runs the Linux file command against each file staged for commit and, if any of them look like an ELF binary executable, you'll be prompted for what to do next. The possible options are:

  • Attempt to automatically fix the issue
  • Abort the commit altogether -- allowing you to fix things manually
  • Continue on and actually commit the binary

If you choose to auto-fix the issue, the following steps will be performed:

  1. Each detected binary file will be unstaged from the current commit
  2. If the unstaged file's basename is not mentioned explicitly in the repository's .gitignore file, it will be appended there.
  3. If any changes are made to the repo's .gitignore, that file will be staged for the current commit.
  4. If all of the above are successful, the commit will proceed -- otherwise an error will be emitted and the commit will be aborted.

If you choose to manually abort the commit, you'll probably want to do all or most of the above steps yourself.

If you choose to commit the binary -- and plan to continue doing so in the future -- you can skip these checks (and associated prompt) by setting the git config variable precommit.allow-binaries to a true value, like so:

git config --bool precommit.allow-binaries 1

Of course, you could always just remove the hook script from your repo too.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].