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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8649507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:18:18  来源:igfitidea点击:

Does SVN have an equivalent to git's commit (without the push)?

gitsvngit-commit

提问by Igor

Basically I want to stage my changes without pushing them and without switching branches. This allows me to do some work, commitit 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 commitagain.

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

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 stashwould suffice, although it seems SVN doesn't have that feature.

我意识到我可以在 SVN 中创建一个功能分支来跟踪这些更改,但同样,我希望在保持在同一个分支/主干中的同时这样做。即使相当于git stash就足够了,尽管 SVN 似乎没有那个功能。

回答by thiton

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.

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

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.

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

回答by Joe

By design SVN does not, however you can use git's git svncommand 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.

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

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

这样的事情可能会有所帮助:http: //www.viget.com/extend/effectively-using-git-with-subversion/

回答by Neil

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.

您也许可以使用 quilt 来执行此操作,但如果您只想将部分 quilt 队列提交给 svn,它会开始变得棘手。