简体   繁体   English

如何使用 git 拉取未跟踪的文件

[英]How to pull untracked files with git

The title may not be clear but my issue is, I have a laravel project on gitlab.标题可能不清楚,但我的问题是,我在 gitlab 上有一个 Laravel 项目。 I cloned the project from the master branch then after running composer install I realized that the bootstrap/autoload.php file was missing.我从 master 分支克隆了项目,然后在运行composer install我意识到 bootstrap/autoload.php 文件丢失了。

But on the develop branch it is there.但是在开发分支上它就在那里。 I merged the develop branch into master but it is not getting the bootstrap/autoload.php file.我将 develop 分支合并到 master 但它没有得到 bootstrap/autoload.php 文件。 I noticed that the last commit on that file was a year ago, so it has been missing for a while, I just didn't notice.我注意到该文件的最后一次提交是一年前,所以它已经丢失了一段时间,我只是没有注意到。

I also noticed that there were other files on the develop branch that were not getting merged into master.我还注意到开发分支上的其他文件没有合并到 master 中。

I checked all my .gitignore files to see if the corresponding files were added but that's not the case because they wouldn't be on gitlab on the develop branch in the first place.我检查了我所有的 .gitignore 文件以查看是否添加了相应的文件,但事实并非如此,因为它们首先不会出现在开发分支的 gitlab 上。

When I run git status on master it says It is up to date.当我在 master 上运行git status ,它说它是最新的。 How do I get those missing files merged into master.如何将那些丢失的文件合并到 master.js 文件中?

I fixed the issue by checking out all the files from the develop branch to master branch:我通过检出从 develop 分支到 master 分支的所有文件来解决这个问题:

git checkout origin/development -- .

This gave me all the files that were missing from master but were in develop这给了我所有在 master 中丢失但正在开发中的文件

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM