![](/img/trans.png)
[英]Git in Xcode 6.3: Master branch showing new files from other branches in red and won't compile
[英]Files from other branches visible in master branch
我正在学习git。 我从master分支创建了一个新的NEW
分支,并在NEW
创建了一个新文件。 现在,当我切换回master时,在master分支中可以看到在NEW
新创建的文件。 正常吗 如果是这样,如何隐藏master分支中其他分支的文件。
直到您添加它( git add <file>
)并提交它( git commit -m 'My new file'
),才跟踪新创建的文件。 这意味着git不知道其在索引树中的存在。
因此,您描述的行为是完全可以预期的。 此架构可以帮助您理解( 源 )。
请尝试以下操作:
git checkout master # start from the master branch
git checkout -b NEW # create and switch onto the NEW branch
echo foo > bar # create a new file
git add bar # track the file
git commit -m 'My new file' # Commit the new file
git checkout master # The file has disappeared from the working directory
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.