简体   繁体   English

一个分支上提交的更改会破坏另一个分支上的内容

[英]Committed changes on one branch break things on another branch

Here's a rundown of the issue:这是问题的概要:

  1. I am running my project on the Xcode simulator, everything is fine.我在 Xcode 模拟器上运行我的项目,一切正常。
  2. I switch to a new branch to update react native.我切换到一个新分支来更新 React Native。 I run npm install and pod install.我运行 npm 安装和 pod 安装。
  3. I try building it, it fails, no problem, there are some kinks to work out.我尝试构建它,它失败了,没问题,还有一些问题需要解决。
  4. I commit the changes I made, I'll come back to it later.我提交我所做的更改,我稍后会回来。
  5. I switch back to the first branch and now the build fails with the same errors that I was getting on the new branch.我切换回第一个分支,现在构建失败,出现与我在新分支上遇到的错误相同的错误。

I haven't made any changes to the first branch, git log is the same as it was before, why is this happening?我没有对第一个分支做任何修改,git日志和之前一样,为什么会这样?

Both are now failing in Android Studio too, though with a different error.两者现在都在 Android Studio 中失败,但错误不同。

Xcode errors: Xcode 错误:

ENOENT: no such file or directory – I think this is because of a space in my path. ENOENT:没有这样的文件或目录——我认为这是因为我的路径中有一个空格。 It wasn't an issue before I did the update but if I fix that, I get:在我进行更新之前这不是问题,但如果我解决了这个问题,我会得到:

The sandbox is not in sync with podfile.lock (What is the sandbox? I wonder if this is the issue?)沙箱与 podfile.lock 不同步(什么是沙箱?我想知道这是否是问题所在?)

Android Studio Errors: Android 工作室错误:

Gradle sync failed: Plugin with id 'maven' not found Gradle 同步失败:找不到 ID 为“maven”的插件

The issue isn't the errors, I can find solutions to those, the issue is that it was working, nothing changed, and now it's not working.问题不是错误,我可以找到解决这些问题的方法,问题是它在工作,没有任何改变,现在它不工作了。

I've run into this two times.我遇到过两次。 The first time I read forums for hours and tried all that I could but the only thing that helped was deleting my local repo and pulling down a new one from the remote.我第一次花几个小时阅读论坛并尽我所能,但唯一有帮助的是删除我的本地存储库并从远程拉下一个新的。 But, it'd be nice to not have to do that every time I update something.但是,如果我每次更新某些东西时不必这样做就好了。

Has anyone run into this?有人遇到过这个吗?

Here're some specs if helpful:如果有帮助,这里有一些规格:

  • Xcode: 13.2.1 Xcode:13.2.1
  • MacOS: Monterrey 12.2 (Intel) MacOS:蒙特雷 12.2(英特尔)
  • Macbook Pro, 16G MacBook 专业版,16G
  • React Native on first branch: 0.65.1第一个分支上的 React Native:0.65.1
  • React Native on new branch: 0.67.4在新分支上反应本机:0.67.4
  • Android Studio: Bumblebee| Android 工作室:大黄蜂| 2021.1.1 Patch 2 2021.1.1 补丁 2
  • Node on first branch: 12.19.1第一个分支上的节点:12.19.1
  • npm on first branch: 6.14.15第一分行 npm:15 年 6 月 14 日
  • Node on new branch: 16.14.0新分支上的节点:16.14.0
  • npm on new branch: 8.3.1 npm 在新分支上:8.3.1

Many thanks in advance!提前谢谢了!

The issue is probably that changes were made to files that are in your gitignore, possibly the Podfile.lock and within node_modules.问题可能是对 gitignore 中的文件进行了更改,可能是 Podfile.lock 和 node_modules 中的文件。 When switching back to your original branch, you'll have to run yarn / npm install again, and then pod install.当切换回原来的分支时,你必须再次运行 yarn / npm install,然后 pod install。 The "sandbox" error occurs when the contents of the Pods directory is out of sync with what is prescribed in the Podfile.当 Pods 目录的内容与 Podfile 中规定的内容不同步时,就会发生“沙盒”错误。

If you've already done that, try stopping your Metro instance and running npx react-native-clean-project .如果您已经这样做了,请尝试停止您的 Metro 实例并运行npx react-native-clean-project There are several caches that could need to be invalidated or refreshed: native builds, Metro, gradle, watchman, etc.有几个缓存可能需要失效或刷新:原生构建、Metro、gradle、watchman 等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 向git分支添加了一个大文件,提交了更改,现在该文件位于每个分支(包括master)中 - Added a large file to a git branch, committed changes, now the file is in every branch (including master) 将分支中的更改合并到其他分支中,而无需合并分支 - Merge changes from branch into different branch without merging the branch 在一个分支中创建的文件在另一个中以红色显示为丢失 - Files created in one branch are shown in another in red as missing 在带有git的Xcode中,您可以合并仅在特定日期后更改的一个分支来掌握吗? - In Xcode with git, can you merge one branch with only changes after a certain date to master? Xcode源控件未显示当前分支更改 - Xcode source control not showing current branch changes 更改分支而不提交时丢失更改 - Lost changes when changed the branch without commit 删除文件时从分支中提取更改 - pull changes from branch when deleting files Git合并忽略来自一个分支的冲突? - Git merge ignore conflict from one branch? XCode和Git:在XCode中打开分支总是会对项目文件进行更改 - XCode and Git: Opening branch in XCode always makes changes to the project file 使用git从一个分支迁移到另一个分支时发生意外错误,在此过程中似乎修改了一些文件 - Unexpected error when rebasing with git from a branch to another branch, some files seems to be modified during the process
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM