Coder Social home page Coder Social logo

git-flow-demo's Introduction

Workflows with git-flow (demonstration)

By installing git-flow, you'll have a handful of extra commands available. Each of these commands performs multiple tasks automatically and in a predefined order. And voila - there we have our workflows!

git-flow is by no means a replacement for Git. It's just a set of scripts that combine standard Git commands in a clever way.

Strictly speaking, you wouldn't even have to install anything to use the git-flow workflows: you could easily learn which workflow involves which individual tasks - and simply perform these Git commands (with the right parameters and in the right order) on your own. The git-flow scripts, however, save you from having to memorize all of this.

Installation procedure

  1. Install git-flow.
sudo apt-get install git-flow
  1. We can check if git-flow is successfully installed by:
dev@jino:~/git-demo$ git flow --version
usage: git flow <subcommand>

Available subcommands are:
   init      Initialize a new git repo with support for the branching model.
   feature   Manage your feature branches.
   bugfix    Manage your bugfix branches.
   release   Manage your release branches.
   hotfix    Manage your hotfix branches.
   support   Manage your support branches.
   version   Shows version information.
   config    Manage your git-flow configuration.
   log       Show log deviating from base branch.

Try 'git flow <subcommand> help' for details.
  1. List the available commands:
dev@jino:~/git-demo$ git flow feature help
usage: git flow feature [list]
   or: git flow feature start
   or: git flow feature finish
   or: git flow feature publish
   or: git flow feature track
   or: git flow feature diff
   or: git flow feature rebase
   or: git flow feature checkout
   or: git flow feature pull
   or: git flow feature delete

    Manage your feature branches.

    For more specific help type the command followed by --help

Initialization and creating feature branches

1.) Let's initialize it in a new project with git flow init

dev@jino:~/git-demo$ git flow init
Initialized empty Git repository in /home/dev/git-demo/.git/
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [feature/] 
Bugfix branches? [bugfix/] 
Release branches? [release/] 
Hotfix branches? [hotfix/] 
Support branches? [support/] 
Version tag prefix? [] 
Hooks and filters directory? [/home/dev/git-demo/.git/hooks]

Demo: git flow init

2.) git flow feature start [feature name]

dev@jino:~/git-demo$ git flow feature start login
Switched to a new branch 'feature/login'

Summary of actions:
- A new branch 'feature/login' was created, based on 'develop'
- You are now on branch 'feature/login'

Now, start committing on your feature. When done, use:

     git flow feature finish login

dev@jino:~/git-demo$ git branch
  develop
* feature/login
  master

Demo: git flow feature start

3.) git flow feature finish [feature name]

dev@jino:~/git-demo$ git branch
  develop
* feature/login
  master
dev@jino:~/git-demo$ git flow feature finish login
Switched to branch 'develop'
Already up to date.
Deleted branch feature/login (was bf2f9c2).

Summary of actions:
- The feature branch 'feature/login' was merged into 'develop'
- Feature branch 'feature/login' has been locally deleted
- You are now on branch 'develop'

dev@jino:~/git-demo$ git branch
* develop
  master

Demo: git flow feature finish

Managing release branches

1.) git flow release start [release version]

dev@jino:~/git-demo$ git branch
* develop
  master
dev@jino:~/git-demo$ git flow release start v1.0.0
Switched to a new branch 'release/v1.0.0'

Summary of actions:
- A new branch 'release/v1.0.0' was created, based on 'develop'
- You are now on branch 'release/v1.0.0'

Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:

     git flow release finish 'v1.0.0'

dev@jino:~/git-demo$ git branch
  develop
  master
* release/v1.0.0

Demo: git flow release start

2.) git flow release finish [release version]

dev@jino:~/git-demo$ git branch
  develop
  master
* release/v1.0.0
dev@jino:~/git-demo$ git flow release finish v1.0.0
Switched to branch 'master'
Deleted branch release/v1.0.0 (was bf2f9c2).

Summary of actions:
- Release branch 'release/v1.0.0' has been merged into 'master'
- The release was tagged 'v1.0.0'
- Release branch 'release/v1.0.0' has been locally deleted
- You are now on branch 'master'

dev@jino:~/git-demo$ git branch
  develop
* master
dev@jino:~/git-demo$ git tag
  v1.0.0

Demo: git flow release finish

3.) Done you can now push your changes to remote master branch and also do not forget to push your newly created tags.

Quick fix from master branch using Hotfixes!

1.) git flow hotfix start [hotfix name]

dev@jino:~/git-demo$ git branch
  develop
* master
dev@jino:~/git-demo$ git flow hotfix start broken-link
Switched to a new branch 'hotfix/broken-link'

Summary of actions:
- A new branch 'hotfix/broken-link' was created, based on 'master'
- You are now on branch 'hotfix/broken-link'

Follow-up actions:
- Start committing your hot fixes
- Bump the version number now!
- When done, run:

     git flow hotfix finish 'broken-link'

dev@jino:~/git-demo$ git branch
  develop
* hotfix/broken-link
  master

Demo: git flow hotfix start

2.) git flow hotfix finish [hotfix name]

dev@jino:~/git-demo$ git branch
  develop
* hotfix/broken-link
  master
dev@jino:~/git-demo$ git flow hotfix finish broken-link
Switched to branch 'develop'
Deleted branch hotfix/broken-link (was bf2f9c2).

Summary of actions:
- Hotfix branch 'hotfix/broken-link' has been merged into 'master'
- The hotfix was tagged 'broken-link'
- Hotfix branch 'hotfix/broken-link' has been locally deleted
- You are now on branch 'develop'

dev@jino:~/git-demo$ git branch
* develop
  master
dev@jino:~/git-demo$ git tag
  broken-link
  v1.0.0

Demo: git flow hotfix finish:

3.) Done!, you can now push your changes to remote master branch and also do not forget to push your newly created tags, you can set git aliases for git flow shorter commands.

Git Aliases

gist alias example

External reference

Git flow

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.