Top Banner
Pimp my Git Pragmatic Git workflow
19

Pragmatic Git workflow

Jan 13, 2015

Download

Documents

Tomek Cejner

How to leverage git branches for clean and readable commit history.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Pragmatic Git workflow

Pimp my GitPragmatic Git workflow

Page 2: Pragmatic Git workflow

Pulling the right way

Building a house

Page 3: Pragmatic Git workflow

Multiple teams

One team builds the roof

Another seeds grass on the yard

Page 4: Pragmatic Git workflow

Conflictless cooperation

Oh, really?

git pull

Page 5: Pragmatic Git workflow

Git problem #721

“pull” does merge by default (rebase is an option)

Page 6: Pragmatic Git workflow

Merging smarter

git pull --rebase

Page 7: Pragmatic Git workflow

Merge

Page 8: Pragmatic Git workflow

Rebase

Page 9: Pragmatic Git workflow

After rebase

Page 10: Pragmatic Git workflow

Commandment

Thou shalt pull with --rebase option.

Page 11: Pragmatic Git workflow

Merging even smarter

$ sudo gem install git-up

Page 12: Pragmatic Git workflow

Building a house

Page 13: Pragmatic Git workflow

My workflow

Create a private branch

and do some work.

Page 14: Pragmatic Git workflow

In the meantime

Someone else started working on the project

Page 15: Pragmatic Git workflow

Risk of conflict

Page 16: Pragmatic Git workflow

Rebase before merge

On feature branch, rebase with master branch

git rebase master

Page 17: Pragmatic Git workflow

Resolve conflict

Resolve conflict on your local branch

git add .

git rebase --continue

Page 18: Pragmatic Git workflow

Merge with squash

git checkout master

git merge feature --squash

git commit

Page 19: Pragmatic Git workflow

Why?

Clean history

Each work item == one commit

Do not trash log with checkpoint commits

Conflicts resolved early

Missing (unnecessary) granularity