SVN 是否有相当于 git 的提交(没有推送)?

发布于 2024-12-22 20:42:12 字数 236 浏览 1 评论 0原文

基本上我想暂存我的更改而不推送它们并且不切换分支。这允许我做一些工作,当我处于良好的停止点时提交它,然后继续在同一个分支中工作。如果我搞砸了,我可以恢复,如果我添加新的更改,我可以再次提交

我意识到我可以在 SVN 中创建一个功能分支来跟踪这些更改,但同样,我想在同一分支/主干中这样做。即使 git stash 的等价物也足够了,尽管 SVN 似乎没有该功能。

Basically I want to stage my changes without pushing them and without switching branches. This allows me to do some work, commit it when I am at a good stopping point, and then continue work in the same branch. If I mess up, I can revert, if I add new changes, I can just commit again.

I realize I can create a feature branch in SVN to track these changes, but again, I'd like to do so while staying in the same branch/trunk. Even the equivalent of git stash would suffice, although it seems SVN doesn't have that feature.

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

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

发布评论

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

评论(3

抽个烟儿 2024-12-29 20:42:12

分布式版本控制的关键在于本地提交的这一功能,可以在以后与上游存储库合并。 SVN不是分布式的,做不到。主要障碍是 SVN 的线性修订编号,这意味着每个客户端都必须为每个变更集获得一个新的识别修订号。由于“分配”修订号并随后使用它会导致各种竞争条件,因此“提交”和“推送”操作在 SVN 和每个非分布式版本控制系统中都是原子的。

话虽如此,正如 Joe 建议的那样,git 的 SVN 前端是一个不错的选择。它确保 SVN 永远不会看到您本地的单独提交,并且“推送”会被转换为单个大型 SVN 提交。

The very point of distributed version control is this feature of local commits that can at a later point be merged with the upstream repository. SVN is not distributed and cannot do it. The central hindrance is SVN's linear revision numbering, which implies that every client must get a new identifying revision number for each changeset. Since "allocating" a revision number and later using it would lead to all kinds of race conditions, the "commit" and "push" actions are atomic in SVN and every non-distributed version control system.

That being said, git's SVN frontend is a good choice, like Joe suggested. It makes sure that SVN never sees your local, individual commits, and the "push" is translated into a single, big SVN commit.

北方的巷 2024-12-29 20:42:12

按照设计,SVN 不支持,但是您可以使用 git 的 git svn 命令作为 SVN 的前端。它允许您从 SVN 远程执行推/拉工作,但仍然在本地使用 git,从而无需推送到 SVN 存储库即可进行本地提交。

像这样的东西可能会有所帮助: http://www.viget.com/扩展/有效地使用-git-with-subversion/

By design SVN does not, however you can use git's git svn command as a front-end to SVN. It allows you to do push/pull work from an SVN remote but still uses git locally, and thus to make local commits without pushing to SVN repository.

Something like this might help: http://www.viget.com/extend/effectively-using-git-with-subversion/

人间☆小暴躁 2024-12-29 20:42:12

您也许可以使用 quilt 来执行此操作,但如果您只想将 quilt 队列的一部分提交到 svn,事情会变得很棘手。

You might be able to use quilt to do this, although it starts getting tricky if you only want to commit part of your quilt queue to svn.

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