从 SVN 更新时是否可以始终(强制)覆盖本地更改?忽略冲突?
我知道我应该在自己的一个分支上工作,但我们几个人在一个项目的同一个分支上。一位开发人员进行了提交,我只想使用 SVN 的最新版本更新我的本地副本。运行“svn update”我得到这个输出:
Restored 'index.html'
U somescript.php
Conflict discovered in file.xml'.
Select: (p) postpone, (df) diff-full, (e) edit,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options:
是否有一个选项/方法可以覆盖我的本地更改并从 subversion 获取最新文件并忽略所有冲突?
我查看了 Stack 上的其他一些帖子,但它们都没有回答这个问题。他们说删除项目并再次结账,我想这是否是最好的方法,就这样吧……但想要更多详细信息来说明为什么我不能强制更新。 谢谢
编辑:
所以我选择了“显示所有选项”:
(s)显示所有选项:s
(e) edit - change merged file in an editor
(df) diff-full - show all changes made to merged file
(r) resolved - accept merged version of file
(dc) display-conflict - show all conflicts (ignoring merged version)
(mc) mine-conflict - accept my version for all conflicts (same)
(tc) theirs-conflict - accept their version for all conflicts (same)
(mf) mine-full - accept my version of entire file (even non-conflicts)
(tf) theirs-full - accept their version of entire file (same)
(p) postpone - mark the conflict to be resolved later
(l) launch - launch external tool to resolve conflict
(s) show all - show this list
我想我应该选择“tc”选项?
I know I should be working on a branch of my own but a couple of us are on the same branch of a project. One of the Dev's made a commit and I just wanted to update my local copy with the latest from SVN. Running 'svn update' I get this output:
Restored 'index.html'
U somescript.php
Conflict discovered in file.xml'.
Select: (p) postpone, (df) diff-full, (e) edit,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options:
Is there an option/way to overwrite my local changes and get the latest file(s) from subversion and ignore all the conflicts?
I've looked at some of the other posts on Stack and they all don't answer the question. They say to delete the project and checkout again, which I guess if that's the best way so be it... But wanting more details as to why I can't force an update.
Thanks
EDIT:
So I selected s 'show all options':
(s) show all options: s
(e) edit - change merged file in an editor
(df) diff-full - show all changes made to merged file
(r) resolved - accept merged version of file
(dc) display-conflict - show all conflicts (ignoring merged version)
(mc) mine-conflict - accept my version for all conflicts (same)
(tc) theirs-conflict - accept their version for all conflicts (same)
(mf) mine-full - accept my version of entire file (even non-conflicts)
(tf) theirs-full - accept their version of entire file (same)
(p) postpone - mark the conflict to be resolved later
(l) launch - launch external tool to resolve conflict
(s) show all - show this list
I guess I should go with option 'tc'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果你真的想要一份 HEAD 的副本(存储库中的最新版本),那么你应该
就是这样。
请注意,您将丢失自上次“提交”以来的所有更改。
编辑:添加了Isu_guy答案-R> 为了完整性并帮助读者找到一个完整的答案
If you really want a copy of HEAD (the latest revision in repos), then you should
That's it.
Beware that you will lose ALL your changes since your last 'commit'.
EDIT: added the
-R <path>
from Isu_guy answer for the sake of completeness and helping readers find a single full answer我会这样做:
或者
也就是说,“svn revert -R”然后在工作副本的根目录下“svn up”也可以解决问题。就我而言,我有多个用于不同项目的 WC,因此我运行一个 shell 脚本,在启动计算机时更新所有这些 WC。我不使用accept,而是使用“--accept p”来推迟解决,因为它是一个自动化过程,然后我合并SVN无法自动合并的任何冲突(通常,这涉及恢复,但这取决于)。
I'd do this:
or
That said, "svn revert -R" then "svn up" at the root of your working copy would also do the trick. In my case, I have several WCs for various projects, so I run a shell script that updates all the them when I start up my computer. I don't use accept, rather I use "--accept p" to postpone resolution since it's an automated process, then I merge any conflicts that SVN can't automatically merge on it's own (usually, this involves reverting, but it depends).
tato的回答绝对正确,请注意他的谨慎。您将丢失所有更改。只是对语法和一些细微差别的澄清
svn revert 默认情况下是非递归的,需要一个工作路径。要使递归添加“-R”。如果您位于当前目录中,请使用“./”作为下面的“路径”或使用绝对路径,例如“/path_to_your_folder”
svn 更新是递归的。如果您位于目录中,则根本不需要路径
tato's answer is absolutely correct and please heed his caution. You will lose ALL your changes. Just a clarification on syntax and some nuances
svn revert is non-recursive by default and needs a path to work on. To make is recursive add "-R". If you are in the current directory use "./" for the "path" below or use an absolute path like "/path_to_your_folder"
svn update is recursive. If you are in the directory you don't need a path at all
使用 svn 1.6.11(由 CentOS 6.4 提供)Carnix 的命令应该如下所示
(无法添加评论,因为我没有足够的声誉)
Using svn 1.6.11 (as shipped by CentOS 6.4) Carnix's command should look like
(cant add a comment since I don't have enough reputation)
回答你的第一个问题。 不。但是您可以通过从项目的根目录运行以下命令来覆盖本地文件:
这适用于我的 mac 上的 svn 1.7.19 和 ubuntu 上的 svn 1.8.8
Answering your first question. No. But you can override your local files by running the following commands from the root of your project:
This worked on my mac with svn 1.7.19 and ubuntu with svn 1.8.8