This question accurately resembles this question: Git merge doesn't merge a file the second time
I will just copy and paste the original question since it describes the background of my question:
I have a master branch with some stuff, let's say file README. I also have a dev branch, child of master, with some additional files, let's say file README2. I do the following: git merge dev from master and get the file README2 merged into master. Now I remove it: git rm README2 Now when I merged dev again, I expected that I will get README2 file merged into master, because it's not in the master anymore. But Git reports there are no changes and nothing to merge. This actually suits me, but I don't understand how is this so, since branch dev at this point clearly has README2 file, while master doesn't.
However, I'm not asking why it happens, I understand that git rebase/merge works at the level of the commit tree, not of individual files, but I would like to ask - in this instance, how would you get back the README2 file from branch dev
? Or in other words, is there a simple way to re-apply the merge as if it happens the first time, without having to delete commits?
EDIT: to put it another way, is there a way to overwrite the files with the files in the other branch, while being asked to solve conflicts? (the exact functionality of using merge)