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
Merges definitely delete files when there's not a conflict with changes in branches.
git does not preserve files during merging if they are deleted in the merging branch. - Nils_M
To prove it to myself, I had to try to reproduce your scenario. See this demonstration in hopes that you can see what it is you are doing differently.
mkdir test
cd test
git init
Initialized empty Git repository in /test/.git/
echo one > 1.txt
echo two > 2.txt
git add .
git commit -m "init repo"
[master (root-commit) feaa910] init repo
2 files changed, 2 insertions(+)
create mode 100644 1.txt
create mode 100644 2.txt
git checkout -b new
Switched to a new branch 'new'
echo three > 3.txt
rm 2.txt
git add .
git status
On branch new
Changes to be committed:
(use "git reset HEAD ..." to unstage)deleted: 2.txt
new file: 3.txt
git commit -m "changes in new"
[new db6b1a0] changes in new
2 files changed, 1 insertion(+), 1 deletion(-)
delete mode 100644 2.txt
create mode 100644 3.txt
git checkout master
Switched to branch 'master'
echo update >> 1.txt
git commit -am "update master"
[master 912a520] update master
1 file changed, 1 insertion(+)
tree
.
├── 1.txt
└── 2.txt
git checkout new
Switched to branch 'new'
tree
.
├── 1.txt
└── 3.txt
git checkout master
Switched to branch 'master'
git merge new master
Removing 2.txt
Merge made by the 'recursive' strategy.
2.txt | 1 -
3.txt | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
delete mode 100644 2.txt
create mode 100644 3.txt
tree
.
├── 1.txt
└── 3.txt
as you can see, the file 2.txt
deleted in the new
branch is now definitely deleted in master
following the merge.