2016-12-14 106 views
3

我以前react-native-git-upgrade升级对我的项目作出反应原住民,过程留下了一些冲突分隔符我现在已经解决:如何使用Git合并工具来解决react-native-git-upgrade冲突?

   DEAD_CODE_STRIPPING = NO; 
<<<<<<< ours 
      HEADER_SEARCH_PATHS = (
       "$(inherited)", 
       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 
       "$(SRCROOT)/../node_modules/react-native/React/**", 
       "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", 
       "$(SRCROOT)/../node_modules/react-native-video", 
      ); 
      INFOPLIST_FILE = "MyAwesomeApp/Info.plist"; 
======= 
       INFOPLIST_FILE = MyAwesomeApp/Info.plist; 
>>>>>>> theirs 
      LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 
      OTHER_LDFLAGS = (
       "$(inherited)", 
       "-ObjC", 
       "-lc++", 
      ); 

但是这些冲突不是由混帐看出:git status不显示任何“未合并的路径”。和git mergetool失败,并显示消息“没有文件需要合并”

所以我不得不通过删除/保留行手动找出它们。有没有办法在这里使用Git合并工具?

回答

5

react-native-git-upgrade是非侵入式的,并且创建临时Git存储库而不是使用现有的存储库。因此,这些临时存储库看到的文件是冲突的,而不是你的。

这个临时的本地Git仓库位于系统临时目录中。您可以在运行时阅读路径react-native-git-upgrade --verboseenter image description here

如果您希望能够使用合并工具,则必须使用临时存储库。就像react-native-git-upgrade一样,使用env var指出这个文件夹内的Git仓库。

对于CLI合并工具:

$ GIT_DIR=/var/folders/vx/jg1x1gd532167rd6ts8y8d2dgp5w7m/T/react-native-git-upgrade/.gitrn git mergetool 

不要忘记追加名为.gitrn回购目录!

请注意,临时目录的路径是特定于计算机的,这就是为什么您必须先运行react-native-git-upgrade --verbose才能获得您的。

+0

当我以正确的路径运行该命令时,出现以下错误 ------------------------ 此消息显示是因为'合并.tool'未配置。有关更多详细信息,请参阅'git mergetool --tool-help'或'git help config'。 'git mergetool'现在将尝试使用以下工具之一: tortoisemerge emerge vimdiff 没有文件需要合并 ------------------------ – rex

+0

这是一个普遍问题。查看[这个问题](http://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git)了解如何解决合并冲突。 – ncuillery