想要设置一个将提交的文件复制到特定文件夹的钩子 [英] Want to setup a hook that copies committed files to a particular folder

查看:80
本文介绍了想要设置一个将提交的文件复制到特定文件夹的钩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:使用PHP Laravel框架开发Facebook应用程序& MySQL for database。

Background: Developing a Facebook app using PHP Laravel framework & MySQL for database.

我在我们的开发服务器上安装了Gitlab,并在其上创建了一个存储库,并且已经添加了团队并正在提交&推送代码。

I have setup Gitlab on our development server and created a repository on it where the team has been added and is committing & pushing code.

我想要做的是,当我将代码推送到GitLab上的特定分支时(例如Master),我希望它可以在/ var / www / productname,以便我可以在Facebook画布中测试它(某些事情发生在那里,不能在本地机器上测试)。

What I would like to do is, when I push code to a particular branch on GitLab (for example Master) I would like it to be available at /var/www/productname so that I can test it within the Facebook canvas as well (certain things happen there that can't be tested on your local machine).

然而, ,我不希望hook在每次推送发生在master上时复制所有文件,只是修改过的文件。

However, I don't want the hook to copy all the files over every time a push happens on master, just the files that were modified.

任何人都可以帮忙一个钩子?

Can anyone help out with such a hook?

谢谢。

推荐答案

cp用于此操作。它会自动区分检查。这样你的post-commit钩子不会变得不必要的复杂。

Use rsync rather than cp for this operation. It does diff checking automatically. that way your post-commit hook doesn't become needlessly complicated.

这篇关于想要设置一个将提交的文件复制到特定文件夹的钩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆