I have a master and a dev branch. I made commits in both. I also deleted some files in dev. I made other commit in master, so this master branch is more recent.
My i
The only way I can fathom this possible situation is if you created two different files, each with the same filename, in independent branches.
i.e. let's say that the master and dev branches already exist.
file.txt to masterdev, then again create and commit file.txt to dev. Now because you have created two distinct files, git views them as two separate entities despite the same filename, defeating the whole purpose of version control.file.txt from devdev into master, and low and behold file.txt still exists in master, and this makes sense because like I said, git views the two files as completely independent.notice if you had not deleted file.txt from dev and attempted a merge, then you would have gotten a merge conflict because git wouldn't know how to handle two different entities with the same path/filename.
If this is your scenario, then I'm going to risk arrogance and say you're doing it wrong ;)
The point of a version control system is to let the tool manage your differences between a file at different stages in time as well as the relationship of those changes to other files in the repository.
My suggestion to improve the workflow in this situation would be to checkout the specific file from the other branch:
file.txt to mastercheckout dev, then just grab the particular file from the other branch
git checkout master -- file.txt
In this situation, you will still be on the dev branch, but have now added file.txt from the master branch.
now git recognizes that these are the same entity. so you can delete the file and commit the removal in dev
dev into master will now delete file.txt from master