Reputation: 7450
We are developing multiple projects on the same base, so we have a company repository with some branches(1 per project + some for merging of projects) and each dev works in his own repo with the same(more or less) branches. Now that one of the projects went live, it basically became the master. Other projects should merge to it and not break anything.
So I have all the code/metadata of one project in my repo and now I have to pull the master from upstream(live project) in order to merge everything. What I tried was simply:
git pull upstream master
This worked(at least I thought it did). After validation, we got some errors that said that some files are missing. So I checked and apparently some files were missing indeed, but git pull upstream master
did not pull them, so in my branch I only see a few(3) out of many(40+) files just in one folder(probably a lot more are missing in other folders, I did not check other folders yet).
If I try to pull again I get the following:
MySuperAwesomeLaptopName:ProjectLocation Novarg$ git pull upstream master
From https://github.com/just_some_super_secret_repository/some_secret_project
* branch master -> FETCH_HEAD
Already up-to-date.
But I do clearly see that it's not up to date, a lot of files are missing!
I have already seen this question, but OP asked for any solution and the answer is basically force overwrite everything.
In my case, I do need to fetch and then to merge from a remote repository.
I could use the answer of the other question and just force overwrite what I have, but it will erase all my work, so I do need to merge everything.
I could manually create all these files in my branch, but that means that I'd have to go over all the names and find only the ones that are missing, then manually copypaste the code and save it.
I also checked my .gitignore
file and these files are not in there.
What can be a reason to such a behaviour and how can I force git to pull/fetch EVERYTHING from upstream?
Upvotes: 4
Views: 466
Reputation: 7450
So basically I still did not find an explanation to what the problem is, but I found a workaround. If somebody can give a good explanation to this behaviour, I'll gladly accept your answer, but for now I'll mark this one as good.
So basically what I did was:
And in terms of git commands it was:
git checkout -b some_other_super_awesome_branch
git pull upstream master
Copy the missing files to some other directory
git checkout my_other_branch
Paste missing files there
git add path/to/my/missing/files/*
git push origin myCoolBranch
Upvotes: 1