24
Presentation of the new GIT REBASE workflow in eXo Copyright 2014 eXo Platform

eXoer on the grill: New Git Rebase Workflow

Embed Size (px)

Citation preview

Page 1: eXoer on the grill:  New Git Rebase Workflow

Presentation of the new

GIT REBASEworkflow in eXo

Copyright 2014 eXo Platform

Page 2: eXoer on the grill:  New Git Rebase Workflow

Why in eXo we stop using GIT MERGE and start using GIT REBASE to integrate change

from one branch to another

Copyright 2014 eXo Platform

Page 3: eXoer on the grill:  New Git Rebase Workflow

A presentation

by Trong from Portal Team Copyright 2014 eXo Platform

Page 4: eXoer on the grill:  New Git Rebase Workflow

Agenda

Copyright 2014 eXo Platform

Enjoy...

1. Git Merge Process2. Git Rebase Introduction3. Rebase - the new eXo Workflow4. Transition/Migration from Merge to Rebase

Page 5: eXoer on the grill:  New Git Rebase Workflow

In eXo we used the

GIT MERGEmethod until today

Copyright 2014 eXo Platform

Page 6: eXoer on the grill:  New Git Rebase Workflow

Process used today

● Using GIT-Merge for integrating changes between branches

● Many feature branches are in progress in parallels

● Merge/Sync feature branches with master frequently, every week(s) regularly

Copyright 2014 eXo Platform

Page 7: eXoer on the grill:  New Git Rebase Workflow

Consequences

Wonderful ???

Copyright 2014 eXo Platform

Page 8: eXoer on the grill:  New Git Rebase Workflow

Amazing graph of commits history

Consequences

Copyright 2014 eXo Platform

Page 9: eXoer on the grill:  New Git Rebase Workflow

Copyright 2014 eXo Platform

Page 10: eXoer on the grill:  New Git Rebase Workflow

Drawbacks

● Commit history is unusable for commit tracker

● Be off the track of Feature Branch development

● Potentially have to reset useless changes

● Don’t have a clear context when resolving conflicts -> easy to make mistakes.

Copyright 2014 eXo Platform

Page 11: eXoer on the grill:  New Git Rebase Workflow

An introduction to the powerful

GIT REBASEmethod to integrate change

Copyright 2014 eXo Platform

Page 12: eXoer on the grill:  New Git Rebase Workflow

Introduction

● Another way (beside Merge) to integrate changes from one branch to another

● Take all the changes (commits) that were committed on one branch and replay them on another one, one by one in turn.

Copyright 2014 eXo Platform

Page 13: eXoer on the grill:  New Git Rebase Workflow

Introduction

● Powerful tool to clean-up/re-organize commit history

● A fast-forward merge to the branch you are rebasing onto.

Copyright 2014 eXo Platform

Page 14: eXoer on the grill:  New Git Rebase Workflow

How it works basicallyLet’s say we have:C1---C2---C6---C7 (master)

\

C3---C4---C5 (feature branch)

After rebase:C1---C2---C6---C7 (master)

\

C3’---C4’---C5’ (feature branch)

Copyright 2014 eXo Platform

Page 15: eXoer on the grill:  New Git Rebase Workflow

How smart

Let’s say C4 and C6 are exactly the same patch, like below:C1---C2---C6---C7 (master)

\

C3---C4---C5 (stabilization)

After rebase:C1---C2---C6---C7 (master)

\

C3’---C5’ (stabilization)

Copyright 2014 eXo Platform

Page 16: eXoer on the grill:  New Git Rebase Workflow

Instantiate the new

WORKFLOWusing Git Rebase

Copyright 2014 eXo Platform

Page 17: eXoer on the grill:  New Git Rebase Workflow

Common rules

● Never push --force in master

● Push --force is only allowed in FBs

● Be careful before pushing with --force

Copyright 2014 eXo Platform

Page 18: eXoer on the grill:  New Git Rebase Workflow

Feature branch

Create a feature branch (FB) from masterC1---C2 (master)

\

C3 (FB)

with C3 is the POMs version update commit

Copyright 2014 eXo Platform

Page 19: eXoer on the grill:  New Git Rebase Workflow

Feature branchAfter a long while, the history looks like:C1---C2---C6---C7 (master)

\

C3---C4---C5 (feature branch)

Integrate changes from master with rebase:C1---C2---C6---C7 (master)

\

C3’---C4’---C5’ (feature branch)

Copyright 2014 eXo Platform

Page 20: eXoer on the grill:  New Git Rebase Workflow

Feature branchMerge to master with non-fast-forward :C1---C2---C6---C7-----------------C8 (master)

\ /

C3’---C4’---C5’ (feature branch)

Merge to master with fast-forward :C1---C2---C6---C7---C4’---C5’ (master)

\

C4’---C5’ (feature branch)

Copyright 2014 eXo Platform

Page 21: eXoer on the grill:  New Git Rebase Workflow

Good Practices

● Squash related commits before merging

● Plan to sync with master as frequently as possible (jenkin jobs ?)

Copyright 2014 eXo Platform

Page 22: eXoer on the grill:  New Git Rebase Workflow

It’s time to

MIGRATEfrom merge to rebase

Copyright 2014 eXo Platform

Page 23: eXoer on the grill:  New Git Rebase Workflow

Transition - Migration

● Start using rebase for new feature branch

● If possible, convert to use rebase on existing feature branches

● Use rebase for auto-merge Jenkins jobs, such as translation injection, etc. ???

● PORTAL team can be in charge of the migration

Copyright 2014 eXo Platform

Page 24: eXoer on the grill:  New Git Rebase Workflow

You are interesting to

LEARN MOREabout our Git Workflow in eXo ?

Copyright 2014 eXo Platform

http://developer.exoplatform.org/docs/scm/git/workflow/