neverfox
neverfox

Reputation: 7030

Git merge failed to bring over some files

I did a large merge from develop to master and Git handled it mostly correctly. But there were three files that definitely existed in both branches prior to the merge but Git only recognized the old ones in master, as they were all marked as added by us. I expected instead to get a conflict I could resolve, because I wanted the changes that exist in develop. The only thing it would let me do to resolve it was either add them (meaning I'd be keeping the old master version or remove them. I choose the latter and attempted another merge, but it says I'm already up-to-date. Now the files exist in develop but not in master, but Git seems to have no clue about this. Why won't Git let me bring these files over and what can I do to resolve this?

Upvotes: 2

Views: 79

Answers (1)

fontno
fontno

Reputation: 6852

So there are 3 files in develop that you want in master. Try this

git checkout master  # make sure you are on the master branch 
git checkout develop -- name_of_file_1.ext name_of_file_2.ext name_of_file_3.ext

This should bring over the 3 files you want from develop in their most recent state.

Upvotes: 1

Related Questions