如何在远程测试时设置git开发环境(How to set up a git development environment when you're testing remotely)
这看起来似乎是一个愚蠢的问题,但我觉得我对GIT理解得相当好,但我似乎无法按照自己的意愿设置我的开发环境。 我要么缺少一些非常简单的东西,要么就是我错了:)
我在我的服务器上初始化了一个裸git repo,将它克隆到我的本地机器,提交了我的文件并推送到原点。 然后,在本地我创建了三个分支(主,发布,开发)并将它们全部发布到原点。 我打算让多个开发人员从开发分支中撤出,我想确保他们不能推送到主分支,但对于另一个问题可能更好。
现在,我在本地对文件进行了更改,然后将它们上传到测试服务器并通过Web浏览器检查测试服务器。 我不得不想象这是大多数人测试他们的工作的方式,除非他们将他们的计算机配置为Web服务器并安装了php和mysql。 一旦我对我的变化感到满意,我就把它们推到原始仓库,一切正常。
我的挑战在于保持测试服务器与本地计算机同步。 我已经尝试在我的远程测试目录中设置一个repo,并且我已经在我的本地git repo中添加了第二个远程,希望我可以推送到测试仓库,以便将测试服务器上的文件与我的本地文件同步。 但我无法弄清楚如何使用两个遥控器并使它们与我的本地机器保持同步。
如果我创建一个新的本地分支,检查它以开始处理新功能,然后将分支推送到我的测试远程,测试远程上的头仍然是主,而不是我的新功能分支。 因此,我在本地更改功能分支,但是当我通过coda将更改发布到测试服务器时,我实际上是在更改测试仓库的主分支上的文件。 如果我无法将我的测试快照与本地快照保持同步,我不知道如何充分利用gits分支功能。
我在本地开发和测试真的非常重要吗? 当您需要远程测试时,如何使用git建立开发环境? 有一个测试回购完全错误的方式来考虑这个? 必须有一种方法可以拥有多个遥控器,并将它们签出到推送的最新分支,这样您就可以在测试服务器上远程同步本地文件的实例。 请帮忙!
This may seem like a silly question, but I feel like I understand GIT fairly well, and yet I can't seem to set up my development environment as I would like. I'm either missing something really simple, or I'm going about it all wrong :)
I initialized a bare git repo on my server, cloned it to my local machine, committed my files and pushed to origin. Then, locally I created three branches (master, release, develop) and published them all to origin. I intend to have multiple developers pulling from the develop branch, and I would like to make sure they can't push to the master branch but that may be better for a different question.
Now, I make my changes to the files locally, and then upload them to the testing server and check the testing server through the web browser. I would have to imagine that this is how most people test their work unless they have their computers configured as web servers and have php and mysql installed. Once I'm happy with my changes, I push them to the origin repo, and everything works fine.
My challenge comes in keeping the testing server in synch with my local machine. I've tried setting up a repo in my remote testing directory, and I've added a second remote to my local git repo, hoping I could push to the testing repo to synch the files on the testing server with my local files. But I can't figure out how to have two remotes and keep both of them in synch with my local machine.
If I create a new local branch, check it out to start working on a new feature and then push the branch to my testing remote, the head on the testing remote is still master and not my new feature branch. Therefore, i'm making changes locally to a feature branch, but when I publish the changes to the testing server through coda, I'm actually changing files on the master branch of the testing repo. If I can't keep my testing snapshots in synch with my local snapshots, I don't know how to take full advantage of gits branching features.
Is it really that crucial that I am developing AND testing locally? How on earth does one set up a development environment with git when you have to test remotely? Is having a testing repo the completely wrong way to think about this? There must be a way to have multiple remotes and have them checkout to the latest branch that is pushed so you can have an instance of your local files in synch remotely on a testing server. PLEASE HELP!
原文:https://stackoverflow.com/questions/21807396
最满意答案
我认为你要找的是
call_user_func_array()
。编辑:类似于:
function do_action($func) { $args = func_get_args(); array_shift($args); // removes the first element return call_user_func_array($func, $args); // magic! }
I think what you're looking for is
call_user_func_array()
.Edit: Something like:
function do_action($func) { $args = func_get_args(); array_shift($args); // removes the first element return call_user_func_array($func, $args); // magic! }
相关问答
更多-
你需要编写一个函数名称,然后用information_schema参数类型查找每个重载,然后为每个重载构建并执行DROP 。 编辑:这结果比我想象的要困难得多。 它看起来像information_schema没有在其routines目录中保留必要的参数信息。 所以你需要使用PostgreSQL的补充表pg_proc和pg_type : CREATE OR REPLACE FUNCTION udf_dropfunction(functionname text) RETURNS text AS $BODY$ ...
-
你可以使用call_user_func_array : function __call($method, $args) { call_user_func_array(array(&$this->c, $method), $args); } 请注意,这不会表现得那么好。 you can use call_user_func_array: function __call($method, $args) { call_user_func_array(array(&$this->c, $metho ...
-
Constructor.newInstance()不知道参数序列?(Constructor.newInstance() without knowing parameter sequence?)[2023-06-04]
您可以使用: Constructor> c = class.getDeclaredConstructor(); c.setAccessible(true); c.newInstance(); 这就是JPA无论如何都会做的,因为它通过no-arg构造函数实例化对象。 You can use: Constructor> c = class.getDeclaredConstructor(); c.setAccessible(true); c.newInstance(); That's what JPA ... -
在不知道为什么有这么多参数和如此多级别的功能的完整细节的情况下,很难给出完整的答案。 但一般来说,传递太多参数被认为是code smell 。 通常,如果一组函数都使用相同的参数,则意味着它们以某种方式密切相关,并且可以受益于将参数封装在类中,以便所有相关方法可以共享该数据。 TooManyParameters通常是CodeSmell。 如果你必须将那么多数据传递到一起,它可能表明数据以某种方式相关并希望封装在它自己的类中。 传递属于独立的单个数据结构并不能解决问题。 相反,这个想法是属于一起的东西,保持在 ...
-
多个参数而不知道理论总数?(multiple parameters without knowing the argumen total ? (PHP functions as parameter topic))[2023-07-12]
我认为你要找的是call_user_func_array() 。 编辑:类似于: function do_action($func) { $args = func_get_args(); array_shift($args); // removes the first element return call_user_func_array($func, $args); // magic! } I think what you're looking for is call_user_ ... -
这将为您提供&分离的URL查询参数的总数: count(explode('&', $_SERVER['QUERY_STRING'])) 如果您只想要唯一参数,请改用$_GET : count($_GET) This will give you the total number of & separated URL query parameters: count(explode('&', $_SERVER['QUERY_STRING'])) If you only want unique paramet ...
-
PHP参数的目的(Purpose of PHP parameters)[2022-01-06]
传递参数允许您多次使用一个函数。 例如: 如果您想编写一个发送邮件的函数 - 您可以传递以下参数: $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['subject']; 然后,在你的功能: function sendmail($to, $from, $subject){ //code to be executed } 现在,您可以在Web应用程序的各个位置重复使用发送功能。 Passing a parameter all ... -
小数据集上的参数选择是否适合总数据集(Whether parameter selection on small dataset will suit for total dataset)[2024-04-23]
这取决于您的30天数据是否代表您的整个持续时间。 换句话说,您的目标应该具有与输入特征相似的分布:i)用于参数选择的30天和ii)您希望预测的未来时间。 例如。 下面的情况将不起作用: 您的数据可能具有某种季节性。 您的9月份客户购买数据不会很好地调整参数以预测圣诞季客户交易。 通常在圣诞节期间,交通量显着增加,产品的类型/类别也大不相同。 That depends on whether your 30-days data is representative for your entire time dur ... -
尝试: count(glob("./database/".$_REQUEST['thetitle'].".*")) try: count(glob("./database/".$_REQUEST['thetitle'].".*"))
-
显示mysql表而不知道PHP中的cols总数(Display mysql Table without knowing total number of cols in PHP)[2022-04-02]
这是因为mysqli_fetch_array提取关联数组和数字数组。 尝试使用mysqli_fetch_assoc或mysqli_fetch_row 。 或者,您可以在mysqli_fetch_array指定参数,如下所示: mysqli_fetch_array($result, MYSQLI_ASSOC) 要么 mysqli_fetch_array($result, MYSQLI_NUM) This is because mysqli_fetch_array fetches both an assoc ...