Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR2446: Git server and git hooks

Hosted by Klaatu on 2017-12-18 00:00:00
Download or Listen

A sample post-receive git hook:


#!/usr/bin/tcsh

foreach arg ( $< )
  set argv = ( $arg )
  set refname = $1
end

set branch = `git rev-parse --symbolic --abbrev-ref $refname`
echo $branch

    if ( "$branch" == "master" ) then
      echo "Branch detected: master"
      echo "Do some stuff here."
    else if ( "$branch" == "dev" ) then
      echo "Branch detected: dev"
      echo "Do something else here."
      else
        echo "Do something entirely different here."
    endif

Comments



More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.