没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
SVN 解决冲突(合并别人的修改)
我们可以使用 svn status -u 来预测冲突,当你运行 svn update
一些有趣的事情发生了:
$ svn update U INSTALL G README Conflict discovered in 'bar.c'.
Select: (p) postpone, (df) diff-full, (e) edit, (h) help
for more options:
U 和 G 没必要关心,文件干净的接受了版本库的变化,文件标示为 U 表
明本地没有修改,文件已经根据版本库更新。G 标示合并,标示本地已
经修改过,与版本库没有重迭的地方,已经合并。
But the next two lines are part of a feature (new in Subversion 1.5)
called interactive conflict resolution. This means that the changes
from the server overlapped with your own, and you have the
opportunity to resolve this conflict. The most commonly used options
are displayed, but you can see all of the options by typing h:
… (p) postpone - mark the conflict to be resolved later
(df) diff-full - show all changes made to merged file (e)
edit - change merged file in an editor (r) resolved -
accept merged version of file (mf) mine-full - accept my
version of entire file (ignore their changes) (tf) theirs-full
- accept their version of entire file (lose my changes) (l)
launch - launch external tool to resolve conflict (h)
help - show this list
Let's briefly review each of these options before we go into detail on
what each option means.
(p)ostpone
Leave the file in a conflicted state for you to resolve after your
update is complete.
(d)iff
Display the differences between the base revision and the
conflicted file itself in unified diff format.
(e)dit
Open the file in conflict with your favorite editor, as set in the
environment variable EDITOR.
(r)esolved
After editing a file, tell svn that you've resolved the conflicts in
the file and that it should accept the current contents—basically
that you've “resolved” the conflict.
(m)ine-(f)ull
Discard the newly received changes from the server and use
only your local changes for the file under review.
(t)heirs-(f)ull
Discard your local changes to the file under review and use only
the newly received changes from the server.
(l)aunch
Launch an external program to perform the conflict resolution.
This requires a bit of preparation beforehand.
(h)elp
Show the list of all possible commands you can use in
interactive conflict resolution.
We'll cover these commands in more detail now, grouping them
together by related functionality.
Viewing conflict differences interactively
Before deciding how to attack a conflict interactively, odds are that
you'd like to see what exactly is in conflict, and the diff command (d)
is what you'll use for this:
… Select: (p) postpone, (df) diff-full, (e) edit, (h)elp
for more options : d --- .svn/text-base/sandwich.txt.svn-base
Tue Dec 11 21:33:57 2007 +++ .svn/tmp/tempfile.32.tmp Tue
Dec 11 21:34:33 2007 @@ -1 +1,5 @@ -Just buy a sandwich.
+<<<<<<< .mine +Go pick up a cheesesteak. +======= +Bring me a
taco! +>>>>>>> .r32 …
The first line of the diff content shows the previous contents of the
working copy (the BASE revision), the next content line is your change,
and the last content line is the change that was just received from the
server (usually the HEAD revision). With this information in hand, you're
ready to move on to the next action.
Resolving conflict differences interactively
There are four different ways to resolve conflicts interactively—two of
which allow you to selectively merge and edit changes, and two of
which allow you to simply pick a version of the file and move along.
If you wish to choose some combination of your local changes, you
can use the “edit” command (e) to manually edit the file with conflict
markers in a text editor (determined by the EDITOR environment
variable). Editing the file by hand in your favorite text editor is a
somewhat low-tech way of remedying conflicts (see“Merging conflicts
by hand”一节 for a walkthrough), so some people like to use fancy
graphical merge tools instead.
In order to use a merge tool, you need to either set
the SVN_MERGE environment variable or define themerge-tool-cmd option
in your Subversion configuration file (see “配置选项”一节 for more
details). Subversion will pass four arguments to the merge tool:
The BASE revision of the file, the revision of the file received from the
server as part of the update, the copy of the file containing your local
edits, and lastly, the merged copy of the file (which contains conflict
markers). If your merge tool is expecting arguments in a different
order or format, you'll need to write a wrapper script for Subversion to
invoke. After you've edited the file, if you're satisfied with the changes
剩余10页未读,继续阅读
资源评论
- 但我不是狼2013-11-11写得很复杂,全是用命令行提交的,所以有点不懂。
qi_ruihua
- 粉丝: 71
- 资源: 57
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功