大型 php/mysql Web 应用程序的版本控制
我正在开发一个大型 php/mysql 应用程序,并且我已经到了必须使用某种版本控制的地步。我读过一些关于 GIT 的文章,但我不知道解决这个问题的最佳方法是什么。
我有一台运行带有 PLESK 的 CENTOS 的专用服务器。我主要在使用 XAMPP 的本地计算机上进行开发。
如果我想使用版本控制,我应该将其安装在使用 PLESK 的服务器上,还是应该将其安装在我的本地计算机上。这也会记录我所做的数据库更改吗?
我的另一件事是 github 的使用。我是否仍然应该将更改上传到中心,或者我是否需要在存储源文件的服务器上创建自己的位置。
谢谢您的宝贵时间!
I am working on a large php/mysql application, and I am getting to the point that i have to use some kind of version control. I have read a few articles on GIT, but i can't seen to figure out what the best way is to go about this.
I have a dedicated server that runs CENTOS with PLESK. And i mainly develop on my local machine that on which u use XAMPP.
If i want to use version control should i install this on the server that uses PLESK, or should i install this on my local machine. And will this also record the database changes i made.
Another thing i question is the use of the github. Should I still upload the changes to the hub, or do i need to make my own place on the server where the source files are stored.
Thank you for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
正常的程序是使用版本控制来开发软件。当您有一个版本需要转到测试或实时服务器时,您可以将代码从存储库部署到测试/实时服务器。
如果您使用 GIT,那么它只需要位于您的计算机上,因为这就是 GIT 的设计方式,作为分布式版本控制系统。如果您使用的是 Subversion,那么它很可能驻留在远离您计算机的服务器上。但在这种情况下,您仍将以相同的方式进行部署。
由于各种原因,将数据库更改添加到版本控制中是不正常的(在 SO 的其他问题中对此进行了讨论)
您只需要在与其他人合作或向广泛开放您的代码时使用 GitHub世界下载和使用。然而,上传到 GitHub 的另一个原因是,如果包含所有代码和存储库的本地计算机崩溃,并且您丢失了可以从那里恢复的本地副本。不过我假设你正在做备份?
编辑-添加
有一本免费书籍,它涉及 git,但要在下面处理,您需要添加一个名为 gitignore 的文件并在其中添加您在存储库中添加了不需要的文件模式。因此,您在目标服务器上有本地配置文件和远程配置文件,但它们不会被覆盖,因为您的本地文件不在存储库中
The normal procedure would be to develop your software using version control. When you have a release that needs to go to the test or live server you would deploy the code from the repository to the test/live server.
If you are using GIT then it only needs to be on your machine as this is how GIT is designed, as a distributed version control system. If you were using Subversion then that may well reside on a server away from your machine. However in this instance you would still deploy in the same way.
It is not normal to add the database changes to version control for various reasons (there is discussion of that in other question here on SO)
You only need to use GitHub if you are working with other people or are opening your code up to the wide world to download and uses. However another reason for uploading to GitHub would be in case your local machine with all the code and the repository crashed and you lost the local copies you could recover from there. However i assume you are making backups?
Edit - addition
There is a free book which deals with git but to deal with below you add a file called gitignore and in it you add the file patterns that you do not want in the repository. so you have local config file and remote config files on the target server but they do mnot get overwritten as your local files are not in the repository
您不需要在部署计算机上进行版本控制,拥有使用开发计算机连接到的 SVN 存储库就足够了。当当前的构建/发布准备好用于生产时,您只需上传/部署它。
您的生产服务器上不需要 SVN 客户端。
您可能还想阅读有关 的文章使用 SVN 进行 Web 开发。
You don't need version control on your deployment machine, it's sufficient to have an SVN Repository which you connect to using your development machine. And when the current build / release is ready for production you simply upload it / deploy it.
There is no need for an SVN client on your production server.
You might also want to read this article about Using SVN for Web Development.
我同意其他答案,但如果您喜欢使用 git 并在远程计算机上有一个快速测试部署方法(用于测试目的),您可以尝试 Gitosis。
这是一个简单的 git 服务器解决方案,简单地说,您可以在远程计算机上拥有自己的“git 服务器”,对于保留工作的远程备份副本很有用。
您可以在本地提交更改或将它们推送回远程计算机。
在远程计算机上,您还必须将存储库克隆到您要用于项目的目录中...
这比看起来更容易,而且效果非常好:)
I agree with other answers but If you like to use git and to have a fast test deployment method on your remote machine (useful for testing purposes) you could give a try to Gitosis.
It's a simple git server solution, simply put you can have your own "git server" on your remote machine, useful to keep a remote backup copy of your work.
Than you can commit your changes locally or push them back to the remote machine.
On the remote machine you'll have to clone the repository also in the directory you're going to use for your project...
It's easier than it seems and it work really good :)
使用 git,您不需要服务器。任何使用 git 的文件夹,即运行 git --init 的文件夹,都会成为 git 存储库,并将所有版本信息存储在该目录的子文件夹 .git 中。
Github 用于开源项目之间的协作 - 在中心位置托管存储库的裸副本 - 裸副本只是没有工作树的 .git 文件夹。
至于是否可以处理mysql数据库内容; git 可以跟踪二进制文件,但 mysql 通常将其数据与应用程序的源文件夹分开存储,因此这可能很难做到。
正如 Filip 所说,您的部署计算机上不需要 VCS;您可以使用 VCS。也就是说,使用 git,你可以增加你的提交。
With git, you don't need a server. Any folder where git is used, i.e.
git --init
is run, becomes a git repository and stores all version information in.git
, a subfolder of that directory.Github is used for collaboration between open source projects - hosting a bare copy of the repository in a central place - a bare copy is just the .git folder without a working tree.
As for whether it can handle mysql database contents; git can track binary files, but mysql typically stores its data separate from your application's source folders, so that might be hard to do.
As Filip says, you don't need VCS on your deployment machine; that said, with git, you could just push up your commits.