Sometimes, having a global configuration isn't enough. You will also need to trigger the execution of scripts (also known as Git hooks), exclude files, and so on. It is possible to achieve this with the template option set to git init
. It can be given as a command-line option to git clone
and git init
, or as the $GIT_TEMPLATE_DIR
environment variable, or as the configuration option init.templatedir
. It defaults to /usr/share/git-core/templates
. The template option works by copying files in the template directory to the .git ($GIT_DIR)
folder after it has been created. The default directory contains sample hooks and some suggested exclude patterns. In the following example, we'll see how we can set up a new template directory, and add a commit message hook and exclude file.
Git Version Control Cookbook
Git Version Control Cookbook
Overview of this book
Table of Contents (19 chapters)
Git Version Control Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Navigating Git
Configuration
Branching, Merging, and Options
Rebase Regularly and Interactively, and Other Use Cases
Storing Additional Information in Your Repository
Extracting Data from the Repository
Enhancing Your Daily Work with Git Hooks, Aliases, and Scripts
Recovering from Mistakes
Repository Maintenance
Patching and Offline Sharing
Git Plumbing and Attributes
Tips and Tricks
Index
Customer Reviews