Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.63 KB

README.org

File metadata and controls

58 lines (40 loc) · 1.63 KB

Useful GIT configuration options

Global Ignores

Tired of setting up editor swap files or Mac DSStore files in all of your git projects. The solution is to create a global gitignore that operates across all of your projects in addition to each projects custom .gitignore

Convention is for your global gitignore file to be in $HOME/.gitignore_global.

git config --global core.excludesfile ~/.gitignore_global

Creating global hooks

By default the hooks directory is $GIT_DIR/hooks, but that can be changed via the core.hooksPath configuration variable.

git config --global core.hooksPath </path/to/my/centralized/hooks>

Then override it in specific repos where required with the following command.

git config core.hooksPath </path/to/my/overridden/hooks>

A good choice for and overridden path would be the default when a global path is not set which is $GIT_Dir/hooks ie the hooks directory in the projects .git directory.

This repo has a hooks directory with the purpose being you can set your core.HooksPath to point to it and gain the benefits of checking for things such as innapropriate whitespace on precommit globally for all projects.

Committing a file that fails hook validation

Sometime you have a file that may have errant whitespace, but you do not have control over its format (eg. structure.sql file in a rails project).

You may need to commit it as is and override the hook checks.

git commit --no-verify

# or use the shorter -n switch

git commit -n

Magit also allows for this option to be added c -n c.