简体   繁体   English

结帐到git中的另一个分支时,新文件显示为红色

[英]New files appear in red when checkout to another branch in git

It's obvious behaviour, when adding new files in a branch, then checking out to another branch, those files appear in red. 显而易见的行为是,在一个分支中添加新文件,然后签出到另一个分支时,这些文件显示为红色。 But I tried to remove them and they are definitely removed when gettig back to the original branch where they were created, so it seems it's not a good idea to remove them. 但是我尝试删除它们,并且在gettig返回创建它们的原始分支时肯定会将它们删除,因此删除它们似乎不是一个好主意。 So how to handle that since the Xcode is throwing that stupid compiling error. 由于Xcode会抛出该愚蠢的编译错误,因此该如何处理。 Thanx. 谢谢

This is not the obvious or correct behavior. 这不是明显或正确的行为。 Your project file is not checked into your Git repository. 您的项目文件未检入Git存储库。 Some people think this is a way to avoid conflicts but it's just a way to make your project not compile. 有人认为这是避免冲突的一种方法,但这只是使您的项目无法编译的一种方法。

git ls-files *.xcodeproj

Will show you if your project.pbxproj managed by Git. 会告诉您您的project.pbxproj是否由Git管理。

You fix this by manually fixing your build settings so every thing compiles and runs then checkin your project file. 您可以通过手动修复构建设置来解决此问题,以便编译并运行所有内容,然后检入项目文件。 You will need to do this in each branch. 您将需要在每个分支中执行此操作。 Your project file will not only have files that have been removed but missing files that have been added. 您的项目文件不仅会包含已删除的文件,还会缺少已添加的文件。

暂无
暂无

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

相关问题 git checkout一个分支,签出回到第一个分支,现在所有内容都以红色删除 - git checkout a branch, checkout back to first branch, now everything deleted in red 删除分支上的文件,防止git checkout - Removed files on branch preventing git checkout Git 在 Xcode 6.3 中:主分支以红色显示来自其他分支的新文件并且不会编译 - Git in Xcode 6.3: Master branch showing new files from other branches in red and won't compile 由于未跟踪的工作树文件导致 git 分支签出问题 - Issues with git branch checkout due to untracked working tree files 使用git从一个分支迁移到另一个分支时发生意外错误,在此过程中似乎修改了一些文件 - Unexpected error when rebasing with git from a branch to another branch, some files seems to be modified during the process 在一个分支中创建的文件在另一个中以红色显示为丢失 - Files created in one branch are shown in another in red as missing 转到其他Mac时,Git子模块文件在XCode中显示红色 - Git Submodule Files showing red in XCode when moving to different Mac 我无法在git中签出其他分支 - I can't checkout other branch in git 使用git在Xcode中提交(和推送)时,不存在的文件出现 - Non existing files appear when committing (and pushing) in Xcode using git Xcode 如何与 Git 一起使用以更改分支和检出旧提交? - How does Xcode work with Git for changing branch and checkout older commit?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM