简体   繁体   中英

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

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 DB shows no differences.

git diff DC 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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM