You want to install the post-update hook on the remote computer you click on.
In the default case, git will not check any data that you click on the remote. Therefore, the default configuration git refuses to click on the marked branch, since the extracted files are no longer updated with HEAD when you click on the extract branch.
When the console receives a click on a branch, you can respond to this in post-update . To find out what will happen, you must first start with some sort of logging:
echo "post update `date`: $*" >> /home/ingo/test/githooks.out
When I click on the new branch, for example, I get the line
post update Mi 24. Jun 13:01:14 CEST 2015: refs/heads/new
where $* contains the branches I clicked on.
With this, you can write just write a script to check this thread. I prefer to check individual heads, since it is much easier to combine work with several modular repositories (without submodules) in a deployed version. See my answer in deploying source code on how to check and work with code outside the git repository.
For example, you could do
for b in $* do B=`basename $b` if [ "$B" = "publish" ]
Of course, you can also do the verification step, which is performed when you click
if [ "`cat HEAD`" = "ref: refs/heads/master" ]
It's great that you will see the output of your hook on the remote control in the terminal where you did push:
# git push remote master:new Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 296 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Updating f81ba5b..a99a710 remote: Fast-forward remote: a.txt | 2 ++ remote: 1 file changed, 2 insertions(+) To ../remote db48da1..a99a710 master -> new