Book Image

Git Version Control Cookbook

Book Image

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
Index

Introduction


In order to function in a corporate environment, there should be certain prerequisites to the code that is produced. It should be able to compile and pass specific sets of unit tests. There should also be certain documentation in the commit messages, such as references to a bug fix ID or an instance. Most of these are just scripts that are executed, so why not put these items in to the process? In this chapter, you will see some examples of how to transfer data from one location to the commit message before you see the message. You will also learn how you can verify whether you are pushing your code to the right location. Finally, you will see how you can add scripts to Git.

A hook in Git is a script that will be executed on different events, such as pushing, committing, or rebasing. These scripts, if they exit with a non-zero value, cancel the current Git operation. You can find these hook scripts in the .git/hooks folder in any Git clone. If they have the .sample file extension...