从 SVN 更新时是否可以始终(强制)覆盖本地更改?忽略冲突?

发布于 2024-09-19 09:26:04 字数 1310 浏览 4 评论 0原文

我知道我应该在自己的一个分支上工作,但我们几个人在一个项目的同一个分支上。一位开发人员进行了提交,我只想使用 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 技术交流群。

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

发布评论

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

评论(5

遥远的她 2024-09-26 09:26:04

如果你真的想要一份 HEAD 的副本(存储库中的最新版本),那么你应该

svn revert -R <path> // discard all your changes inside path (recursive)
svn update           // get latest revision of all files (recursive)

就是这样。

请注意,您将丢失自上次“提交”以来的所有更改。

编辑:添加了Isu_guy答案-R> 为了完整性并帮助读者找到一个完整的答案

If you really want a copy of HEAD (the latest revision in repos), then you should

svn revert -R <path> // discard all your changes inside path (recursive)
svn update           // get latest revision of all files (recursive)

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

鹿港巷口少年归 2024-09-26 09:26:04

我会这样做:

svn up --accept tf

或者

svn up --accept theirs-full

也就是说,“svn revert -R”然后在工作副本的根目录下“svn up”也可以解决问题。就我而言,我有多个用于不同项目的 WC,因此我运行一个 shell 脚本,在启动计算机时更新所有这些 WC。我不使用accept,而是使用“--accept p”来推迟解决,因为它是一个自动化过程,然后我合并SVN无法自动合并的任何冲突(通常,这涉及恢复,但这取决于)。

I'd do this:

svn up --accept tf

or

svn up --accept theirs-full

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).

ゞ记忆︶ㄣ 2024-09-26 09:26:04

tato的回答绝对正确,请注意他的谨慎。您将丢失所有更改。只是对语法和一些细微差别的澄清

svn revert 默认情况下是非递归的,需要一个工作路径。要使递归添加“-R”。如果您位于当前目录中,请使用“./”作为下面的“路径”或使用绝对路径,例如“/path_to_your_folder”

svn revert -R <path>

svn 更新是递归的。如果您位于目录中,则根本不需要路径

svn update

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 revert -R <path>

svn update is recursive. If you are in the directory you don't need a path at all

svn update
缱倦旧时光 2024-09-26 09:26:04

使用 svn 1.6.11(由 CentOS 6.4 提供)Carnix 的命令应该如下所示

svn up --accept theirs-full

(无法添加评论,因为我没有足够的声誉)

Using svn 1.6.11 (as shipped by CentOS 6.4) Carnix's command should look like

svn up --accept theirs-full

(cant add a comment since I don't have enough reputation)

风追烟花雨 2024-09-26 09:26:04

回答你的第一个问题。 。但是您可以通过从项目的根目录运行以下命令来覆盖本地文件:

svn revert -R .
svn update

这适用于我的 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:

svn revert -R .
svn update

This worked on my mac with svn 1.7.19 and ubuntu with svn 1.8.8

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