在从react-native 0.56到0.57.3运行react-native-git-upgrade时,我完成了大多数步骤,但在Generate the patch between the 2 versions上失败了
git-upgrade info Check for updates
git-upgrade info Using yarn 1.9.4
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.57.3, React 16.6.0-alpha.8af6728
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
warning: CRLF will be replaced by LF in node_modules/chain-function/.gitattributes.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in node_modules/chain-function/.npmignore.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in node_modules/chain-function/index.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in node_modules/chain-function/test.js.
The file will have its original line endings in your working directory.
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
git-upgrade info Commit old version template
git-upgrade info Install the new version
warning "react-native > metro > babel-preset-fbjs > @babel/plugin-check-constants@7.0.0-beta.38" has incorrect peer dependency "@babel/core@7.0.0-beta.38".
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
git-upgrade info Commit new version template
git-upgrade info Generate the patch between the 2 versions
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'git diff --binary --no-color HEAD~1 HEAD' exited with code null:
stderr: undefined失败的特定git命令正在比较node_modules/`中的两个文件
diff --git a/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/lodash/_getSymbolsIn.js b/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/lodash/_getSymbolsIn.js
deleted file mode 100644
index cec0855..0000000
--- a/node_modulesgit-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'git diff --binary --no-color HEAD~1 HEAD' exited with code null:
stderr: undefined编辑:
在将.gitignore更改为仅忽略Pod和node_modules之后,我得到
git-upgrade info Save the patch in temp directory
git-upgrade info Reset the 2 temporary commits
HEAD is now at b09d589 Project snapshot
git-upgrade info Apply the patch
error: .flowconfig: does not exist in index
error: patch failed: android/app/build.gradle:137
Falling back to three-way merge...
Applied patch to 'android/app/build.gradle' with conflicts.
error: patch failed: android/build.gradle:1
Falling back to three-way merge...
Applied patch to 'android/build.gradle' with conflicts.
error: patch failed: android/gradle/wrapper/gradle-wrapper.properties:2
Falling back to three-way merge...
Applied patch to 'android/gradle/wrapper/gradle-wrapper.properties' with conflicts.
error: patch failed: ios/Neuron.xcodeproj/project.pbxproj:13
Falling back to three-way merge...
Applied patch to 'ios/Neuron.xcodeproj/project.pbxproj' with conflicts.
error: ios/Neuron.xcodeproj/xcshareddata/xcschemes/Neuron-tvOS.xcscheme: does not exist in index
error: patch failed: ios/Neuron/Info.plist:9
Falling back to three-way merge...
Applied patch to 'ios/Neuron/Info.plist' with conflicts.
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts.
git-upgrade info Upgrade done
git-upgrade info Temporary working directory: /var/folders/dl/t15md38s6b1d9sfsnbk7my280000gn/T/react-native-git-upgrade 我的git目录中没有任何更改,但临时工作目录中有一个修补程序
发布于 2018-10-21 15:01:22
基于此链接,该链接表明git命令由于.gitignore而失败:https://github.com/facebook/react-native/issues/11402
我清除了我的.gitignore,除了Pods和node_modules,它基本上起作用了。
当我收到像does not exist in index或patch failed这样的错误,但它也输出git-upgrade info Upgrade done,并且git status没有返回任何更改时,我转到Temporary working directory上的补丁,看到有一个补丁文件。在此讨论:https://github.com/facebook/react-native/issues/12112#issuecomment-284491701
在我的repo中,我按照上面的讨论应用了它,并计划修复冲突。
git apply $TMPDIR/react-native-git-upgrade/<patch file name> --rejecthttps://stackoverflow.com/questions/52912579
复制相似问题