Reputation: 1106
Some weeks ago I create a feature branch, I'm developing in. There are severals commits and some new files as well. I can change from master branch to my development branch and versa vice and everything is fine.
Today I tried to merge my branch back to the master branch. Therefore I changed to master and called
git merge mydevbranch
which resulted in several merge conflicts. i resolved these conflicts with
git mergetool
But now, I realized, there are some files missing within the result I have to commit. So there are two questions: Shouldn't be there all merged items on my hard disk after merging? How can I proceed to get the real merge result (master + my feature branch).
Upvotes: 8
Views: 16840
Reputation: 7020
It's not possible to lose files that way.
You may try this alternative:
git checkout mydevbranch
# following command to find the previous state easier if you are not familiar with reflog
git branch tmp-checkpoint
git rebase master
Then solve conflicts. If the files are still missing, you can use git bisect (see man page) to find the point where they disappear
Upvotes: 1
Reputation: 36
For your first question: Shouldn't be there all merged items on my hard disk after merging?
I do a experiment on my own environment. It has the same effect as you has. So my conclusion is that, the file deleted in your master branch will not come back in your master branch if you merge the develop branch which has that same file.
I think this makes sense. Let's assume that you had deleted lots of unwanted files in the master branch and commit those removals. Then you merge the develop branch who has all those unwanted files. If all those unwanted files are 'added' into the master branch again, you may be upset to see that happen because you have to take time to delete them again.
Upvotes: 1
Reputation: 1106
After some investigation I found the following. The file was added by me on master before creating the branch (that's why it was in my dev-branch). But now the crazy thing: The file was deleted in master afterwards by a colleague, but without any status information. Status log only shows the creation of the file. So the merge was correct, but due to the missing status information it was not comprehensible to me.
Upvotes: 6
Reputation: 448
Check if there is nothing in stash
git stash pop
For new files, please make sure you add them first (git status should list them)
git add
The best docs about Git at all, including branches: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
Upvotes: 3