Top Banner
git-flow CarrenzaLabs branching model and best practices
23

git-flow R3Labs

Feb 12, 2017

Download

Documents

Raül Pérez
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: git-flow R3Labs

git-flowCarrenzaLabs branching model and best

practices

Page 2: git-flow R3Labs

What is git-flow?git flow are a set of git extensions to provide high-level repository operations for Vincent Driessen’s branching model.

http://nvie.com/posts/a-successful-git-branching-model/

Page 3: git-flow R3Labs

Basic tips●Git flow provides excellent command line

help and output.Read it carefully to see what’s happening …

●Git flow is a merge based solution. It doesn’t rebase feature requests.

Page 4: git-flow R3Labs

Setup●You need a working git installation as a

prerequisite.●Git flow works on OSX, Linux and Windows.

●OSX:○brew install git-flow

●Linux:○apt-get install git-flow

Page 5: git-flow R3Labs

Getting Started●Start using git-flow by initializing it inside an

existing git repository○git flow init

●You’ll have to answer a few questions regarding the naming conventions for your branches.

●It’s recommended to use the default values.

Page 6: git-flow R3Labs

FeaturesFor example new task that you need to work on, and usually originated from a JIRA issue.

Page 7: git-flow R3Labs

Features●Develop new features for upcoming

releases.

●Typically exist in developers repos only.

Page 8: git-flow R3Labs

Start a new feature●Development of new features starting from

the “develop” branch.

●Start developing a new feature with:○git flow feature start <MYFEATURE>

●This action creates a new feature branch based on “develop” and switches to it.

Page 9: git-flow R3Labs

Finish up a feature●Finish the development of a feature. This

action performs the following:○git flow feature finish <MYFEATURE>

●Merged MYFEATURE into “develop”.●Removes the feature branch.●Switches back to “develop” branch.

Page 10: git-flow R3Labs

Publish a feature●Are you developing a feature in

collaboration?

●Publish a feature to the remote server so it can be used by other users.

○git flow feature publish <MYFEATURE>

Page 11: git-flow R3Labs

Getting a published feature●Get a feature published by another user.

○git flow feature pull origin <MYFEATURE>

●You can track a feature on origin by using○git flow feature track <MYFEATURE>

Page 12: git-flow R3Labs

ReleasesFinished work! Bump a new version!

Page 13: git-flow R3Labs

Make a release●Support preparation of a new production

release.

●Allow for minor bug fixes and preparing meta-data for a release.

Page 14: git-flow R3Labs

Start a release●To start a release, use the git flow release

command. It creates a release branch created from the “develop” branch.

○git flow release start <RELEASE>

Page 15: git-flow R3Labs

Publish a release●It’s wise to publish the release branch after

creating it to allow release commits by other developers.Do it similar to feature publishing with the command:

○git flow release publish <RELEASE>

Page 16: git-flow R3Labs

Finish up a release●Finish a release is one of the big steps in git

branching. It performs several actions:○git flow release finish <RELEASE>

●Merges the release branch back into master.●Tags the release with its name.●Back-merges the release into “develop”.●Removes the release branch.

Page 17: git-flow R3Labs

Commit your work●Commit your work after you finish the

release.○git commit origin --all○git push origin --tags

Page 18: git-flow R3Labs

HotfixesDoh! We’re doomed … We broke production.

Run for you live!

Page 19: git-flow R3Labs

Hotfixes●Hotfixes arise from the necessity to act

immediately upon an undesired state of a live production version.

●May be branched off from the corresponding tag on the master branch that marks the production version.

Page 20: git-flow R3Labs

Start a new hotfix●Development of new hotfixes starting from

the “master” branch.

●Start developing a new hotfix with:○git flow hotfix start <MYFEATURE>

●This action creates a new hotfix branch based on “master” and switches to it.

Page 21: git-flow R3Labs

Finish up a hotfix●Finish the development of a hotfix. This

action performs the following:○git flow hotfix finish <MYHOTFIX>

●Merged MYHOTFIX into “master”.●Removes the hotfix branch.●Switches back to “develop” branch.

Page 22: git-flow R3Labs

Commit your work●Commit your work after you finish the hotfix.

○git commit origin --all○git push origin --tags