git - How can a revert commit also be a merge commit? -


recently @ work, lost code on project under version control using git (and private github repository).

i used git bisect find culprit commit, , got surprised discovering looking revert commit, had 2 parents merge commits :

commit b5f97311eea2905baf8a96fddec22321d952f05c merge: 8cc7371 131d463 author: bob <bob@othercompany.com> date:   fri may 22 19:42:25 2015 +0200      revert "isb-cpw-3627 - mise en place du calage des filtres ds1/ds2/ds3/ds4"      reverts commit 8cc7371e7133b68db95ac8e9aeb730d7889a1166. 

this issue has been resolved creating new branch ancestor commit, , applying patches on top of new branch.

so don't need fix that, want understand how can revert commit merge commit, happened, , how reproduce weird behavior.

i tried reproduce :

  • create new branch @ 8cc7371
  • git revert 8cc7371

it creates revert commit single parent (8cc7371) expected.

the culprit commit author uses atlassian sourcetree instead of native command line interface, tried using revert feature within sourcetree , got same result above (single parent).

after running git commands on b5f9731, noticed git diff , git show not reporting same file set :

$ git diff b5f9731..8cc7371 --name-only => 2 files :    application/sites/frontend/views/scripts/layout/foobar/pointsdevente/index.tpl    public/media/design/frontend/css/main-dev.css $ git show --oneline --name-only  b5f9731 => 1 file :    public/media/design/frontend/css/main-dev.css 

sourcetree , github showing 2 files.

you can find how graph looks here : graph.html, , git commands results there : misc.html.

could explain happened b5f9731 ?

what comes mind:

git revert ... # new commit abcdef git merge ... # new commit fedcba git rebase -i head~2  pick abcdef - original revert commit squash fedcba - merge commit 

message taken abcdef.

this results in new b5f9731. has 2 parents merge commit , message revert commit.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -