Git

Hooks

pre-push

The pre-push script is called by git pushthe push actually happens. If the exist status is 0, then the push will proceed, otherwise it will be stopped.

The script is supplied with the following arguments:

 $1 -- Name of the remote to which the push is being done (Ex: origin)
 $2 -- URL to which the push is being done (Ex: https://<host>:<port>/<username>/<project_name>.git)

Information about the commits which are being pushed is supplied as lines to the standard input in the form:

<local_ref> <local_sha1> <remote_ref> <remote_sha1>

Sample values:

local_ref = refs/heads/master
local_sha1 = 68a07ee4f6af8271dc40caae6cc23f283122ed11
remote_ref = refs/heads/master
remote_sha1 = efd4d512f34b11e3cf5c12433bbedd4b1532716f