Git forensics: all changes on dev branch disappeared after merge into master

Viewed 141

My team just discovered that all changes (edits, added files) from a development branch disappeared when that branch was merged into "master".

-- A --- B --- D --   "master"
    \         /
      -- C --       "dev"

git diff D B shows no differences.

git diff D C shows lots of differences.

There should have been no merge conflicts.

The merge was probably performed using SourceTree.

Is there a simple explanation for how such a thing might have happened? We'd like to avoid doing it again.

Thanks!

1 Answers

The only way to get that in Git is by explicitly asking for it. There are various ways to do it, there's various workflows for which that's a legitimate merge result, but it's not the default and you can't just fatfinger the request, you have to ask for it. One way is a -s ours merge. Another is to do a git reset HEAD before committing the merge. If SourceTree makes it easy to fatfinger that, that's on them.

Related