创建本地SVN分支

发布于 2024-11-11 12:51:45 字数 366 浏览 1 评论 0原文

我正在处理 SVN 存储库,并且不想创建新的 SVN 分支。相反,我想在我的计算机本地创建一个分支,这可以使用 Git

但我目前正在使用 SVN,并且需要从已经修改的 SVN 版本中分支出来。本质上,我想要以下内容:

  • svn_repo_version =
  • 2259working_copy=modified 2259
  • new_local_svn_branch = based onmodified 2259

最好的方法是什么?

I am working on an SVN repository and do not want to create a new SVN branch. Instead of that, I want to create a branch local to my machine, something which could be done easily with Git.

But I am currently using SVN and need to branch out from an already-modified SVN version. In essence, I want following:

  • svn_repo_version = 2259
  • working_copy = modified 2259
  • new_local_svn_branch = based on modified 2259

What is the best way to go about it?

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

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

发布评论

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

评论(2

浮生面具三千个 2024-11-18 12:51:46

Subversion 是一个集中式版本控制系统。集中式系统的一些优点是它迫使每个人都使用相同的代码库。你不可能一次隐藏你的工作几个月,然后在重大发布前两天突然把它放下。不好的部分是你不能真正拥有一个私有分支而不让它出现在存储库中。

您没有理由不能创建自己的分支。事实上,我曾经给我们的开发人员一个特殊的“私有”目录,他们可以在其中放置自己的代码并进行私有分支。我有一个预提交脚本,只允许分支的所有者进行更改,尽管我已经设置了它,所以任何人都可以看到它。

如果您担心您的私有分支可能会堵塞 branches 目录,请记住您可以在完成后从 branches 目录中删除分支。或者,您可以请求一个并行的 private 目录,您可以在其中放置您的东西。

如果您确实想创建一个真正的私有区域,可以在其中使用 Subversion 并签入代码,而不会出现在主存储库中,那么我知道您有两个选择:

  • SVK:这是一个前端分布式版本控制系统,在后端使用 Subversion。您可以创建自己的 Subversion 存储库,并在本地存储库和主存储库之间来回发布更改。

  • Git:Git 附带了一个名为 git-svn 的工具 它允许您将数据从 Subversion 存储库提取到本地 Git 存储库。然后,您可以使用本地 Git 存储库进行分支,然后将更改推送回 Subversion。甚至还有 Tortoise 的 Git 版本。

唯一需要注意的是,您必须亲自使用这两个工具的命令行界面。

Subversion is a centralized version control system. Some of the advantages of a centralized system is that it forces everyone to play with the same codebase. You can't hide your work for months at a time, then suddenly plop it down two days before a major release. The bad part is that you can't truly have a private branch and not have it show up in the repository.

There's no reason why you shouldn't be able to create your own branch. In fact, I use to give our developers a special "private" directory where they could put their own code, and do private branching. I had a pre-commit script that only allowed the owner of the branch to make changes, although I had it setup, so anyone could see it.

If you're worried that your private branches might clog up the branches directory, remember you can remove a branch from the branches directory when you're done. Or, you can request a parallel private directory where you can put your stuff.

If you really want to create a true private area where you can use Subversion and check in code without it appearing in the main repository, you have two choices I know of:

  • SVK: This is a front end distributed version control system that uses Subversion on its backend. You can create your own Subversion repository, and post changes back and forth between your local repository and the master repository.

  • Git: Git comes with a tool called git-svn which allows you to pull data off of a Subversion repository into a local Git repository. You can then use your local Git repository to do your branching, and later push your changed back into Subversion. There's even a Git version of Tortoise.

The only caveat is that you will have to get your hands dirty with the command line interface with both of these tools.

星光不落少年眉 2024-11-18 12:51:46

恐怕您将不得不创建一个新分支并不断将任何更改合并到其中。唯一的选择是简单地签出分支,继续更新并且不提交(或在提交之前继续切换)直到完成。如果您需要在原始分支/主干上工作,您始终可以拥有两个工作副本。远非理想,但这就是 SVN 的工作方式,考虑到当时的替代方案,这仍然非常好。

如果您希望通过我的 IDE (Eclipse )。

I'm afraid you will have to create a new branch and keep merging any changes into it. The only alternative is to simply checkout the branch, keep updating and don't commit (or keep switching prior to commits) until you are finished. You could always have two working copies if you need to work on the original branch/trunk. Nowhere near ideal, but that's the way SVN works, which is still very good given the alternatives at the time.

I personally manage local history if that is what you are after via my IDE (Eclipse).

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