Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Reverting a merge. Without console. Mikhail Mat...

CEE-SECR
October 21, 2017

Reverting a merge. Without console. Mikhail Matrosov, Align Technology, CEE-SECR 2017

If you are a little frustrated with what “reverting a merge” is, this talk is for you. Using this operation as an example, I will talk about some important yet non-obvious Git concepts, which we need in our daily work. Notably, I am not going to show a single console command, rather using client with graphical interface to perform all operations. The basic knowledge of Git is assumed.

CEE-SECR

October 21, 2017
Tweet

More Decks by CEE-SECR

Other Decks in Technology

Transcript

  1. October 2017, St. Petersburg Software Engineering Conference Russia Reverting a

    merge Mikhail Matrosov Technical Manager at Align Technology
  2. 2

  3. 3

  4. A B C D E M master 10 1 2

    1 = merged to 2 = merged from
  5. 12 A B C D E M master 1 2

    A B C D E M’ master 2 1
  6. 13

  7. 14

  8. A B C D E master 15 M ^M F

    M2 dev only F is merged
  9. A B C D E master 16 M ^M F

    ^^M dev F is merged, D and E brought back by ^^M M2 Pros: commits D and E are preserved Cons: complicated history
  10. A B C D E master 17 M ^M dev

    D’ E’ F M2 Pros: new branch has regular workflow Cons: commits D and E are duplicated
  11. A B C D E master 18 M ^M dev

    ^^M F M2 Pros: preserves conflicts resolution happened in M Cons: commits D and E are not visible in new branch
  12. 19

  13. 22

  14. 23

  15. References • Basic info: https://git- scm.com/blog/2010/03/02/undoing-merges.html • More details: https://opensource.apple.com/source/Git/Git-

    26/src/git-htmldocs/howto/revert-a-faulty- merge.txt • On order of commits: http://devblog.nestoria.com/post/98892582763/ maintaining-a-consistent-linear-history-for-git 24