Git如何在mergetool之后合并冲突

时间:2012-05-18 16:53:43

标签: git

我在git中使用mergetool,它会弹出opendiff,我喜欢它。我查看了这些变化,并选择应该去哪里。我点击“保存”然后回头看看终端。它问我Was the merge successful? [y/n]我回答是,但我不知道怎么说“使用我刚刚保存的新合并文件!不是他们的,不是我们的,而是我刚刚保存的那个”

Normal merge conflict for 'www/httpdocs/manifest/subsectionmanager-storage':
  {local}: modified file
  {remote}: modified file
Hit return to start merge resolution tool (opendiff): 
www/httpdocs/manifest/subsectionmanager-storage seems unchanged.
Was the merge successful? [y/n] y

Normal merge conflict for 'www/httpdocs/workspace/themes/active/less/common.less':
  {local}: modified file
  {remote}: modified file
Hit return to start merge resolution tool (opendiff): 
www/httpdocs/workspace/themes/active/less/common.less seems unchanged.
Was the merge successful? [y/n] ^[[A
www/httpdocs/workspace/themes/active/less/common.less seems unchanged.
Was the merge successful? [y/n] y
kirkstrobeck:atheycreek kirkstrobeck$ git add .
kirkstrobeck:atheycreek kirkstrobeck$ git add -u
kirkstrobeck:atheycreek kirkstrobeck$ git commit -m 'merged'
[master f6fed72] merged
 12 files changed, 1330 insertions(+), 29 deletions(-)
 mode change 100644 => 100755 www/httpdocs/workspace/data-sources/data.status_all_entries.php
 mode change 100644 => 100755 www/httpdocs/workspace/data-sources/data.twitter.php
 mode change 100644 => 100755 www/httpdocs/workspace/data-sources/data.twitter_latest_entry.php
 create mode 100755 www/httpdocs/workspace/themes/active/less/common.less.orig
 mode change 100644 => 100755 www/httpdocs/workspace/uploads/members/photos/amy_mcreynolds-4fb2e70566fb9.jpg
 mode change 100644 => 100755 www/httpdocs/workspace/uploads/members/photos/rachel-4fb2e793b13bd.jpg
 mode change 100644 => 100755 www/httpdocs/workspace/uploads/members/photos/tim-4fb3da80b15e3.jpg
 mode change 100644 => 100755 www/httpdocs/workspace/xml-importers/xml-importer.twitter.php
 mode change 100644 => 100755 www/httpdocs/workspace/xml-importers/xml-importer.ustream.php
 mode change 100644 => 100755 www/httpdocs/workspace/xml-importers/xml-importer.vimeo.php
 mode change 100644 => 100755 www/mysql/atheycreek_2012-05-16.sql
kirkstrobeck:atheycreek kirkstrobeck$ git stash apply
Auto-merging www/httpdocs/workspace/themes/active/less/common.less
CONFLICT (content): Merge conflict in www/httpdocs/workspace/themes/active/less/common.less
Auto-merging www/httpdocs/manifest/subsectionmanager-storage
CONFLICT (content): Merge conflict in www/httpdocs/manifest/subsectionmanager-storage
kirkstrobeck:atheycreek kirkstrobeck$ 

kirkstrobeck:atheycreek kirkstrobeck$ git config --global --list
user.name=kirkstrobeck
user.email=kirk@strobeck.com
user.user=kirkstrobeck
user.token=fd0010cb7e13a3f9bafe9766cfa81e7c
core.editor=nano
core.excludesfile=/Users/kirkstrobeck/.gitignore_global
github.user=kirkstrobeck
github.token=fd0010cb7e13a3f9bafe9766cfa81e7c
difftool.sourcetree.cmd=/Applications/Kaleidoscope.app/Contents/MacOS/ksdiff -w "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/SourceTree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
difftool.Kaleidoscope.cmd=ksdiff-wrapper git "$LOCAL" "$REMOTE"
difftool.prompt=false
diff.tool=Kaleidoscope
mergetool.keepbackup=true
kirkstrobeck:atheycreek kirkstrobeck$ 

2 个答案:

答案 0 :(得分:1)

听起来在git中没有正确配置opendiff。你的

中应该有以下一行
git config mergetool.<tool>.trustExitCode true
  

如果自定义合并工具正确指示合并成功   分辨率及其退出代码,然后是配置变量   mergetool..trustExitCode可以设置为true。除此以外,   git-mergetool将提示用户指示成功   自定义工具退出后的分辨率。

http://www.kernel.org/pub/software/scm/git/docs/v1.7.3/git-mergetool.html

答案 1 :(得分:1)

您需要运行以下命令才能接受合并的结果作为要使用的新代码:

git config --global mergetool.[tool].trustExitCode true