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
- Git Flow is a utility for supporting branch management in Git.
- Command to verify installation : git flow
- Installation guide: https://github.com/petervanderdoes/gitflow-avh/wiki/Installation
- For macOS, use :
brew install git-flow-avh
Setting up SSH for GitHub
- GitHub offers support for both HTTPS and SSH protocols.
- Pros and cons exist for each : https://git-scm.com/book/ko/v2/Git-서버-프로토콜
- Run the commands below to add your SSH key to GitHub
# 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)
Host github.com
User git
Hostname github.com
IdentityFile ~/.ssh/id_rsa
Port 20022
Git Flow Strategy
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
- Clone the source code using Git
- 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
.
$ 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