了解 Git,使用 php ide 和 ftp
在我过去的项目中,我未能投入时间来正确设置我的工作区。
对于备份+版本控制,我只需将网络目录文件复制到硬盘上的单独文件夹中,如果我发现在某个地方犯了错误,我会重新加载以前的备份并从该点重新开始,经常浪费宝贵的时间重复工作已经做了。
我的 IDE 没有 ftp 功能,我必须手动将文件从桌面复制到网络服务器,不断覆盖文件并进行复制。
我确信有一种更好、更有效的方法来完成上述任务。我读过有关 Git 版本控制的内容,并且知道我应该使用它。
有什么建议的方法可以通过 IDE、版本控制和 FTP 来高效工作(操作系统是 Windows),从而避免我的汗水、泪水和数据丢失?
编辑:我目前正在使用 netbeans IDE
In my past projects I have failed to invest time in setting up my workspace correctly.
For backups + version control I simply copy my webdirectory files to a separate folder on my hard-disk, if I find I have made a mistake somewhere, I reload a previous backup and start again from that point, often wasting precious time repeating work I have already done.
My IDE has no ftp functionality, I have to manually copy the files from my desktop to my webserver, constantly overwriting files and duplicating.
I am certain there is a better, more efficient way of doing the above. I have read about Git for version control and know I should be using it.
What is the suggested way to work efficiently (OS is Windows) with an IDE, version control and FTP that will save me sweat, tears and data loss?
EDIT: I am currently using netbeans IDE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
版本控制 - 如果使用得当 - 比简单地复制文件要好得多。在单用户环境中,版本控制允许您对版本控制进行细粒度控制,通常采用比完整文件副本更节省空间的方式,因为旧版本存储为差异。
在多开发人员环境中,版本控制提供了相同的好处,但您还必须考虑多人同时编辑同一文件的情况。在最简单的情况下,两个人在不同的位置编辑同一个文件,您可以安全地按顺序进行这两项修改。在更复杂的情况下,两个或更多开发人员对同一代码区域进行更改,并且需要手动合并。
Git 与传统版本控制系统的不同之处在于,它被设计为以分布式方式使用。也就是说,每个开发人员都有自己的存储库,并且在需要时进行合并。如果您想要的话,您可以拥有一台权威的中央服务器,但您不需要一直对该服务器做出很大的承诺。这使得 git 特别适合个人或远程开发。 Git 不需要桌面上有一台繁重的服务器,只需要一个小的二进制文件。
git 上有很多教程。其中一些是:
Version control - when used properly - is much better than simply copying files around. In a single user environment, version control allows you to have fine-grain control over your versioning, often in a way that is more space efficient than full file copies because the old versions are stored as diffs.
In a multi-developer environment, version control provides the same benefits, but you also have to consider the case when multiple people edit the same file at the same time. In the simplest case, two people edit the same file in different places and you can safely take both modifications in sequence. In more complex cases, two or more developers make changes to the same region of code and it needs to be manually merged.
Git is different from traditional revision control systems in that it was designed to be used in a distributed fashion. That is - each developer has their own repository, and merges happen when they need to happen. You can have an authoritative central server if you want one, but you don't need to make very commit to that server all the time. This makes git particularly suitable to individual or remote development. Git doesn't require a heavy server on your desktop, just one small binary.
There are a lot of tutorials out there on git. Some of them are:
这是我的设置的工作原理 - 这对您来说可能可行,也可能不可行,但我希望它能有所帮助。我不再使用 FTP 做任何事情。
您应该获得 DVCS 设置,选择哪一种完全取决于您。其中任何一个都比手动复制或什么都没有要好。我建议看看 Git 和 Mercurial,然后做出决定。在我看来,如果您主要使用 Windows,Mercurial 可能是更好的选择。如果没有,我会建议使用 Git。你总是可以两者都尝试!
我设置了一个 gitolite 服务器,它充当我所有 git 项目的中央存储库。拥有一个远程中央存储库非常棒,因为您的整个代码库都会在您的工作站发生故障时得到备份 - 最重要的是,您可以使用它进行一些代码协调来移动文件(并停止使用 FTP) )。
设置完成后,我开始
拉动
和推送
它的过程 - 你在这里谈论你的 IDE,并且有很多 Git IDE 选项,但是我只使用命令行 - 我发现它更快。同样,如何合并取决于您。在 Web 开发方面,我设置了 gitolite 服务器以使用 git-hooks 将更改传播到我的服务器。它们都安装了 git 客户端,因此代码库通常位于 webroot 中。当更改从我的工作站推送到 gitolite 服务器时,它会触发一些自动更新生产服务器的命令。它不仅方便,而且还将代码库及其版本的副本放在您的服务器上。但要小心这一点;您需要确保您没有共享您的
/.git
目录。基本思想是改善您的开发生态系统。我的 Git 设置非常适合这一点。您可能需要评估整个工作流程并根据您的需求进行调整。
这是 NetBeans 的
git
插件。 不过,我建议您在开始使用时使用命令行。Here's how my setup works - this may or may not be feasible for you, but I hope it helps somehow. I no longer use FTP for anything.
You should get a DVCS setup, and which one you choose is entirely up to you. Any of them will be better than manually copying or not having anything at all. I suggest taking a look at both Git and Mercurial and making a decision from there. In my opinion, if you're using Windows primarily, Mercurial might be a better choice. If not, I'd say go for Git. You could always try both!
I setup a gitolite server which acts as a central repository for all of my git projects. It is great to have a remote central repository because your entire codebase is backed up in the case that your workstation should fail - and on top of that, you can use it to do some code coordination to move your files around (and stop using FTP).
Once that is setup, I start the process of
pull
ing andpush
ing to it - you talk about your IDE here, and there are a lot of Git IDE options, but I just use the command line - I just find it faster. Again, up to you on how to incorporate that.In terms of web development, I setup my gitolite server to use git-hooks to propagate changes to my servers. They all have the
git
client installed, so the codebase is usually in the webroot. When a change is pushed from my workstation to the gitolite server, it fires off some commands that automatically updates the production server. Not only is it convenient, but it also puts a copy of the codebase and its versions on your servers as well. Be careful with this though; you need to make sure you aren't sharing your/.git
directory.The basic idea is to improve your development ecosystem. My Git setup is perfect for that. You might need to assess your entire workflow and make adjustments based on your needs.
Here's the
git
plugin for NetBeans. I suggest using the command line when you get started, though.