Skip to content

Instantly share code, notes, and snippets.

@andresmoschini
Last active September 13, 2018 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andresmoschini/f79e0fd9731440015ae29fbc0db91a6b to your computer and use it in GitHub Desktop.
Save andresmoschini/f79e0fd9731440015ae29fbc0db91a6b to your computer and use it in GitHub Desktop.
Branches and Merges

Before merge


*      A2
|  
|  *   B2
|  |  
|  *   B1
|  |
*  |   A1
| /
|/
|
*      Base (develop)

Merge as it is

Current Doppler approach (when no conflicts)


|
*         Merge B in develop
|\
| \
*  \      Merge A in develop
|\  \
| \  \ 
|  *  |   A2
|  |  |
|  |  *   B2
|  |  |  
|  |  *   B1
|  |  |
|  *  |   A1
|  | /
|  |/
|  /
| /
|/
|
*      Base (develop)

Merge as it is with backward merge

Old Doppler approach (when there are conflicts)


|
*         Merge B in develop
|\
| \
|  \
|   \
|    \
|     *   Merge develop in B
|    /|
|   / |
|  /  |
| /   |
|/    |
*     |   Merge A in develop
|\    |
| \   | 
|  *  |   A2
|  |  |
|  |  *   B2
|  |  |  
|  |  *   B1
|  |  |
|  *  |   A1
|  | /
|  |/
|  /
| /
|/
|
*      Base (develop)

Rebase and merge commit

Relay / Doppler when there are conflicts


|
*      Merge B in develop
|\
| \
|  *   commit B2'
|  |
|  *   commit B1'
| /
|/
*      Merge A in develop
|\
| \
|  *   commit A2
|  |
|  *   commit A1
| /
|/
*      Base (develop)
|

Rebase without merge commit

Forms Editor


|
*   commit B2'
|
*   commit B1'
|
*   commit A2'
|
*   commit A1'
|
*   Base (develop)
|

Rebase & Squash

Making Sense standard


|
*   Squash de B1 y B2
|
*   Squash de A1 y A2
|
*   Base (develop)
|

See MakingSense's Development Guidelines

Commits as progressive code improvement and not development history

  • πŸ‘ Atomic commits
  • πŸ‘Ž WIP commits
  • πŸ‘Ž PR with commits for fixes (exceptions, alternatives)
  • πŸ‘Ž Commits reverting previous code in the same PR
  • βš’ Interactive rebase
  • βš’ fixup! commit
  • βš’ Reset mixed
  • βš’ Start a new branch, stealing code and ideas from the old one

Comparison

  • Merge as it is (with with backward merge if necessary)
    • πŸ‘ Long living branches, see Why you should stop using rebase, Stop cherry-picking
    • πŸ‘Ž Short feature branches
    • πŸ‘Ž Not clear history, difficulties to revert a merge
    • πŸ‘Ž Merge responsibility diluted
    • πŸ‘Ž Local tests could not include remote changes
  • Rebase and merge commit
    • πŸ‘ PRs clearly visible
    • πŸ‘ Independent commits clearly visible
    • πŸ‘Ž Redundant information
    • πŸ‘Ž Atomic PRs
    • πŸ‘ Not so atomic PRs with meaninful commits
  • Rebase without merge commit
    • πŸ‘ Very clear history
    • πŸ‘Ž PRs not visible easily
    • πŸ‘ Atomic PRs
    • πŸ‘ Not so atomic PRs with meaninful commits
  • Rebase & Squash
    • πŸ‘ Very clear history
    • πŸ‘ PRs not visible easily
    • πŸ‘ Atomic PRs
    • πŸ‘Ž Not so atomic PRs with meaninful commits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment