Web 开发问题的基本版本控制 - 单个开发人员。 (SVN/GIT)

发布于 2025-01-08 12:00:39 字数 995 浏览 1 评论 0原文

经过长时间的延迟,我意识到我想在我的 Web 开发工作流程中实现一个版本控制系统。我很少与其他人一起工作,所以我需要的只是版本控制,以便安心和回滚的能力等。我也在工作室使用笔记本电脑和台式机进行开发,所以我想使用版本控制,这样我就可以在不同的地点工作并避免由此产生的冲突。

我已经做了相当多的研究,大多数教程都相当高级,似乎超出了我的需要。基本上,我已经决定使用 beanstalk 和 Versions.app 的 SVN 存储库来使用它。

然而,在真正深入研究解决方案之前,我想先回答三个简单的问题:

  • 是否真的有必要使用典型的 SVN 结构(主干/分支/标签)?我可以不简单地使用repo作为web-root吗?

  • 我如何从分支机构中受益? Beanstalk 建议从分支进行部署。据我了解,这可能意味着创建一个生产分支,然后在部署之前从主干合并到该分支?有没有理由不简单地从 Trunk 进行部署,或者只是在 SVN 中拥有一个 Webroot 并进行部署?我想我主要是问为什么,作为一个单独的开发人员,我想在开发网站时使用分支?

  • 我有什么理由可以从 GIT 中受益吗?我可以看到是否离线提交的一个主要功能,但 beanstalk 甚至推荐 SVN 用于 Web 开发文件(html、php、图像等)。

非常感谢任何帮助。一段时间以来,我一直想使用版本控制系统并离线开发。希望我不再编辑实时服务器!我认为,一开始制定正确的工作流程是一个耗时和精力密集的项目,但最终非常值得。

--

编辑:我主要开发 WordPress 网站和各种规模相当小的 EE 项目,没有什么太激烈的。

--

编辑: 与所有事情一样,使用系统并尝试它是真正了解它的唯一方法。最终我选择了git。我很高兴能够快速离线提交、快速分支和合并等。然后,使用 capistrano 进行部署,虽然最初设置起来很复杂,但令人难以置信。我的工作流程现在得到了极大的改善。我可以快速分支新功能并尝试新想法。没有git我再也不会开发项目了!

After much delay, I realize I want to implement a version control system into my workflow for web development. I rarely work with others, so all I need is version control for peace of mind and ability to rollback etc. I also develop from a laptop and desktop at the studio, so I would like to use version control so I can work from different locations and avoid conflicts that emerge from that.

I have done a fair bit of research, and most tutorials are rather advanced and seem beyond my needs. Basically, I have decided on an SVN repository from beanstalk and Versions.app to work with it.

However, I have three quick questions I would love to answer before really diving into a solution:

  • Is it really necessary to use a typical SVN structure (trunk/branches/tags)? Can I not simply use the repo as the web-root?

  • How can I benefit from Branches? Beanstalk recommends deploying from branches. From what I understand, this could mean creating a Production branch, then merging to that branch from the Trunk before deploying? Is there a reason not to simply deploy from the Trunk or just having a webroot in SVN and deploying that? I suppose I am mainly asking why, as a single developer, I would want to use branches in developing websites?

  • Is there any reason I could benefit from GIT? The one main feature I could see if offline commits, but beanstalk even recommends SVN for web development files (html, php, images etc).

Any help greatly appreciated. I've been wanting to use a version control system and develop offline for some time now. Hopefully no more editing live servers for me! I think getting the right workflow down is a time and energy intensive project in the beginning, but so well worth it in the end.

--

edit: I am developing mostly wordpress websites, and various EE projects on a reasonably small scale, nothing too intense.

--

edit: As with everything, working with the system and trying it out is the only way to really get to know it. In the end, I opted for git. I was very happy with being able to commit offline quickly, to do quick branches and merging etc. Then, deployment with capistrano, while initially complex to setup, has been unbelievable. My workflow is so fantastically improved now. I can branch new features quickly and try out new ideas. I will never develop a project again without git!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

鸠魁 2025-01-15 12:00:39

我建议遵循标准结构。如果您稍后邀请其他开发人员加入,并且他们熟悉标准结构,那么事情就会容易得多。

即使您独自一人,使用发布标签也非常有帮助。假设您将一个版本投入生产,但结果很糟糕。如果您总是从主干执行操作,那么您必须查看日期或变更集才能回滚。如果您标记了先前的版本,您只需获取标记并推送它,而无需担心一个更改在哪里结束、另一个更改从哪里开始。

创建标签很简单,但您从中获得的价值却是巨大的。

我在一个只有 2 名开发人员的项目上工作了 18 个月,但我们还没有创建分支。我怀疑您也不需要使用它们,而是可以从您的发布标签进行部署。

I would recommend following the standard structure. If you do bring other developers on later and they are familiar with the standard structure it'll be that much easier.

Using tags for releases is very helpful even if you are all alone. Say you push a version to production and it's botched. If you are always doing things from trunk then you have to look at the date or changesets in order to rollback. If you tagged the previous release you can just get the tag and push it without any stress about where one change ends and another begins.

Creating a tag is trivial and the value you get from it is huge.

I've been on a project with only 2 developers for 18 months and we have not yet created a branch. I suspect you won't need to use them either and could instead deploy from your release tags.

放手` 2025-01-15 12:00:39

我使用 SVN 多年,有时仍然使用,但我正在慢慢地将我的团队切换到 git。Git 更快、更灵活,并且允许本地提交。您可以在线或离线工作。使用 git,您不需要文件夹分支和标签的结构——你只需说 git 分支或 git 标签,它就会自动拍摄你的项目的快照。 svn 和 git 都有优点和缺点,但总的来说,我认为我会更喜欢 git 。其也。 “新事物”,因此当您最终与团队合作时,它可能会更好地学习,

因此主干(或 git 中的主干)是当前代码所在的位置。需要几个小时以上的开发工作会在分支中进行——对于您正在工作的网站,随着错误修复和内容进入主干,我们会将它们合并回我们的分支中。最新的修复和微小的更改当分支完成后,我们进行部署。为此,将其设为主干,并将旧主干归档。我们还会对我们发布的所有内容进行标记,以便我们对已投入生产的内容有一个快照。

您可以查看 github 上的私人存储库来开始。或者你可以只在本地使用 git,但最好有一个异地服务器用于备份或将某些内容拉到另一台机器上。

I used SVN for years and still do at times, but I"m slowly switching my team to git. Git is faster, more flexible and allows for local commits. You can work online or offline. With git, you do not need a folder structure for branches and tags--you just say git branch or git tag and it takes a snapshot of your project automatically. There are pros and cons to both svn and git, but overall I think i'm going to like git a bit better. Its also "the new thing" so it may be better for you to learn for when you do eventually work with teams.

We branch by release. So the trunk (or master in git) is where the current code resides. Bug fixes and quick changes go there. Development that will take longer than a few hours goes in a branch--for new projects, additions, to the website your working on. As bug fixes and things go into the trunk, we merge these back into our branch so it has the latest fixes and minor changes. When the branch is done, we deploy to that, make it the trunk, and archive the old trunk. We also tag anything we release, so we have a snapshot of what went to production.

I you might look into private repos on github to get started. Or you can just work locally with git, but its nice to have an offsite server for backups or to pull something down to another machine.

他夏了夏天 2025-01-15 12:00:39

你确实有4个问题

真的有必要使用典型的SVN结构(主干/分支/标签)吗?

不,它只是更可用、更有用且经过长期测试的工作流程:标签是永久标签,分支允许单独解决任务并隐藏最终点(在主干中)的复杂性,并且在您拥有时不会破坏所有项目未完成的事情

我可以不简单地使用存储库作为网络根吗?

您本身不能使用存储库 - 存储库不是文件系统中的树,与您的项目相同。您可以尝试使用工作副本作为站点,但可管理(更新“内容”和“何时”)未版本化快照(至少我认为是这样)是更自然的方式

我如何从分支机构中受益?

单独的开发线,其中:

  • 不干扰主线
  • 允许并行解决多个任务并严格分离变更

我有什么理由可以从 GIT 中受益吗?

不是来自 Git,而是来自 DVCS 作为类 - 是的,这是可能的(不是必须的):每个人都有自己的理由

You have really 4 questions

Is it really necessary to use a typical SVN structure (trunk/branches/tags)?

No, it's just more usable and useful and long-time tested workflow: tags are permanent labels, branches allow to solve task separately and hide complexity from final point (in trunk), and don't broke all project while you have something unfinished

Can I not simply use the repo as the web-root?

You can't use repository per se - repository isn't tree in filesystem, identical to your project. You can try to use working copy as site, but manageable (updated "what" and "when") unversioned snapshot (at least I consider so) is more natural way

How can I benefit from Branches?

Separate line of development, which:

  • doesn't interfere with mainline
  • allow to solve more one task in parallel with strict separation of changes

Is there any reason I could benefit from GIT?

Not from Git, but from DVCS as class - yes, it's possible (not a must): and everybody have own reasons

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文