Implementation of multi-branch automatic publishing example based on Git

Source: Internet
Author: User

Git and Incron are used to automate Web site publishing, but a git version of a system where multiple branches are posted on a single server is too redundant. Therefore, it is necessary to deal with multiple branches of automatic publishing scheme.

Found a way here.

http://www.ekynoxe.com/git-post-receive-for-multiple-remote-branches-and-work-trees/


Combined with Incron technology, the ultimate solution is to modify the post-receive hook


#!/bin/bash
While read Oldrev Newrev ref
Todo
Branch= ' echo $ref | cut-d/-f3 '

If ["Master" = "$branch"]; Then
Date + "%y-%m-%d%h:%m:%s" >>/home/wlx/westdc.git/hooks/westdc.update.lck
Fi

If ["heihedata" = = "$branch"]; Then
Date + "%y-%m-%d%h:%m:%s" >>/home/wlx/westdc.git/hooks/heihedata.update.lck
Fi

If ["card" = = "$branch"]; Then
Date + "%y-%m-%d%h:%m:%s" >>/home/wlx/westdc.git/hooks/card.update.lck
Fi
Done

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.