使GIT自动提交每个文件更改 [英] Make GIT auto-commit every file change

查看:413
本文介绍了使GIT自动提交每个文件更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道已经有人问过这个问题,但是我也想分享我的情况,以关注其他解决方案和技巧.我们开发PHP网站,并在远程半成品服务器上测试所有内容,以了解我们的Web应用程序在现实世界中如何工作.

I know that this was already asked, but I want to share my situation also to focus on alternative solutions and tips. We develop PHP websites, and we test everything on a remote semi-production server, to see how our web applications work in the real world.

通常,我们在计算机上安装远程SFTP,然后直接在服务器上进行读/写(然后我们从测试服务器每晚进行一次备份到另一个),因此我们不必保存和上传每个文件.改变.

Usually, we mount remote SFTP on our computers, and read/write directly on the server (then we have a nightly backup from the test server to another), so we haven't to save-and-upload every file we change.

现在,我们正在考虑切换到GitHub来跟踪文件更改.我已经在Mac上安装并配置了GitHub,并且已经安装了一个Webhook,该Webhook会自动从我们的GIT存储库中拉出并测试Web服务器.因此,当我提交并同步到GitHub时,我可以刷新在浏览器中更改的页面以查看其运行情况.

Now we are considering to switch to GitHub to track file changes. I already installed and configured GitHub on my Mac, and a webhook that automatically pull from our GIT repository to out test web server. So, when I commit and sync to GitHub, I can refresh the page(s) I changed in my browser to see it in action.

问题在于,Web脚本通常由许多微更改组成,有时您必须连续单击保存"并切换到浏览器以检查其是否正常运行...因此必须提交(并指定摘要) !)每次都是不可接受的.

The problem is that web scripting is often made of many micro-changes, sometimes you have to continuously hit "save" and switch to the browser to check if it works correctly... so having to commit (and specify a summary!) everytime is unacceptable.

我们如何通过工作流程解决此问题?

How we can solve this problem with the workflow?

谢谢.

推荐答案

简单地说:您不应该这样做.

Simply put: you shouldn't do that.

源代码管理系统不适用于测试并将开发中的代码传输到测试服务器.您应该像以前一样使用SFTP或设置rsync.这些是转移工具.

Source code management systems are not for testing and transferring your code under development to testing servers. You should either work with SFTP as before or set up rsync. These are the tools for transfer.

您应该使用GitHub来仅存储有效的完整更改.在测试了微更改"并获取了可用的快照之后,您应该提交并描述自上次提交以来所做的所有修改.

You should use GitHub to store only working, complete changes. After testing your "micro-changes" and getting to a working snapshot you should commit and describe everything you modified since the last commit.

其他任何事情都只是破解您尝试使用的工具.按照您的建议进行操作,只会(几乎)失去git给您的所有好处,并且比使用普通的sftp/rsync方便得多.

Anything else would be just hacking the tools you try to use. Doing what you propose would just mean loosing (nearly) all benefits that git gives you and would be much less convenient than using plain sftp/rsync.

这篇关于使GIT自动提交每个文件更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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