Git Flow Summary

This document provides a concise summary of Git flow configuration, strategies, and command examples.

Info

This article was originally written in Korean and has been translated using ChatGPT.

Prerequsite

Installing Git

  • Command to verify installation: git
  • Download Git suitable for your operating system : https://git-scm.com/

Git flow Installation

Setting up SSH for GitHub

1
2
3
4
5
6
7
8
# Create an SSH key (omit this step if a key already exists)
mkdir ~/.ssh
ssh-keygen -t rsa -C "${github_id}@github.com"
  
# Copy the SSH public key
cat ~/.ssh/id_rsa.pub
  
# Add the copied key to your GitHub account at https://github.com/settings/ssh
  • If the GitHub SSH port differs, extra configuration is needed.
  • Insert the details below into the ~/.ssh/config file. (Create this file if it’s not already present)
1
2
3
4
5
Host github.com
    User git
    Hostname github.com
    IdentityFile ~/.ssh/id_rsa
    Port 20022

Git Flow Strategy

gitflow

Branch Overview

  • master branch: Houses the source that is deployed or awaiting deployment.
  • develop branch: Used for development in preparation for the next release.
    • A collaborative branch for multiple developers.
    • Development involves pushing completed code to develop branch or merging after PR review.
  • feature branch: For feature-specific development by individual developers.
    • Branch for local development.
    • To be merged into the develop branch.
  • hotfix branch: For urgent fixes required in the deployed version.
    • Originates from the master branch.
    • Merged directly into the master branch and also applied to the develop branch.
  • release branch: Contains code ready for internal release.
    • The branch used for QA testing.
    • Immediate application of fixes for bugs found during QA, with necessary changes also made to the develop branch.
    • Should not be used for additional feature development; such features should be reserved for the next release."

Start Project

Clone Project from github

  1. Clone the source code using Git
  2. Navigate to the project directory

git flow init

  • Ensure that the master and develop branches are already established locally.
  • Running ‘git flow init’ will launch a dialog mode to confirm settings, as shown below.
  • Stick to the default settings for all configurations (feature, release, hotfix, …).
  • The bugfix and support branches, recent additions to git flow, may be absent or experimental depending on the git flow edition/version, and therefore are not recommended for use.
  • On macOS, generate a popup window using Cmd + Option + f.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
$ git flow init
 
Which branch should be used for bringing forth production releases?
   - master
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? []

Git Flow Commands

Info

Use MYFEATURE and RELEASE as branch names
ex) feature/test123 → FEATURE = test123

  • Start a new feature : git flow feature start MYFEATURE
  • Complete a feature : git flow feature finish MYFEATURE
  • Publish a feature : git flow feature publish MYFEATURE
  • Pull a published feature : git flow feature pull origin MYFEATURE
  • Start a release : git flow release start RELEASE [BASE]
  • Finish a release : git flow release finish RELEASE
  • Start a hotfix : git flow hotfix start VERSION [BASENAME]
  • Finish a hotfix : git flow hotfix finish VERSION

Reference

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy