lifebender
7/1/2019 - 10:26 AM

A comparison of using `git flow` commands versus raw `git` commands.

A comparison of using git flow commands versus raw git commands.

Initialize

gitflowgit
git flow initgit init
 git commit --allow-empty -m "Initial commit"
 git checkout -b develop master

Connect to the remote repository

gitflowgit
N/Agit remote add origin git@github.com:MYACCOUNT/MYREPO

Features

Create a feature branch

gitflowgit
git flow feature start MYFEATUREgit checkout -b feature/MYFEATURE develop

Share a feature branch

gitflowgit
git flow feature publish MYFEATUREgit checkout feature/MYFEATURE
 git push origin feature/MYFEATURE

Get latest for a feature branch

gitflowgit
git flow feature pull origin MYFEATUREgit checkout feature/MYFEATURE
 git pull --rebase origin feature/MYFEATURE

Finalize a feature branch

gitflowgit
git flow feature finish MYFEATUREgit checkout develop
 git merge --no-ff feature/MYFEATURE
 git branch -d feature/MYFEATURE

Push the merged feature branch

gitflowgit
N/Agit push origin develop
 git push origin :feature/MYFEATURE (if pushed)

Releases

Create a release branch

gitflowgit
git flow release start 1.2.0git checkout -b release/1.2.0 develop

Share a release branch

gitflowgit
git flow release publish 1.2.0git checkout release/1.2.0
 git push origin release/1.2.0

Get latest for a release branch

gitflowgit
N/Agit checkout release/1.2.0
 git pull --rebase origin release/1.2.0

Finalize a release branch

gitflowgit
git flow release finish 1.2.0git checkout master
 git merge --no-ff release/1.2.0
 git tag -a 1.2.0
 git checkout develop
 git merge --no-ff release/1.2.0
 git branch -d release/1.2.0

Push the merged feature branch

gitflowgit
N/Agit push origin master
 git push origin develop
 git push origin --tags
 git push origin :release/1.2.0 (if pushed)

Hotfixes

Create a hotfix branch

gitflowgit
git flow hotfix start 1.2.1 [commit]git checkout -b hotfix/1.2.1 [commit]

Finalize a hotfix branch

gitflowgit
git flow hotfix finish 1.2.1git checkout master
 git merge --no-ff hotfix/1.2.1
 git tag -a 1.2.1
 git checkout develop
 git merge --no-ff hotfix/1.2.1
 git branch -d hotfix/1.2.1

Push the merged hotfix branch

gitflowgit
N/Agit push origin master
 git push origin develop
 git push origin --tags
 git push origin :hotfix/1.2.1 (if pushed)

References