Skip to content

Instantly share code, notes, and snippets.

@raidenz
Forked from JamesMGreene/gitflow-breakdown.md
Last active July 10, 2017 05:32
Show Gist options
  • Save raidenz/e8b890af449f68a79c524f40f3ac86cb to your computer and use it in GitHub Desktop.
Save raidenz/e8b890af449f68a79c524f40f3ac86cb to your computer and use it in GitHub Desktop.
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
x git commit --allow-empty -m "Initial commit"
x git checkout -b develop master

Connect to the remote repository

gitflow git
N/A git remote add origin git@github.com:MYACCOUNT/MYREPO

Notes

While using GIT / Bitbucket PR (Pull Request Mode) You must publish your feature online Then create PR, then delete it manually on local branch Use git branch -r then git remote prune origin or git pull --prune

Features

Create a feature branch

gitflow git
git flow feature start MYFEATURE git checkout -b feature/MYFEATURE develop

Share a feature branch

gitflow git
git flow feature publish MYFEATURE git checkout feature/MYFEATURE
x git push origin feature/MYFEATURE

Get latest for a feature branch

gitflow git
git flow feature pull origin MYFEATURE git checkout feature/MYFEATURE
x git pull --rebase origin feature/MYFEATURE

Finalize a feature branch

gitflow git
git flow feature finish MYFEATURE git checkout develop
x git merge --no-ff --no-edit feature/MYFEATURE
x git branch -d feature/MYFEATURE

Finalize a feature branch Alternative fix conflict

gitflow git alt
git flow feature finish MYFEATURE git checkout feature/MYFEATURE
x git merge --no-ff --no-edit develop
x git push origin feature/MYFEATURE (merge online)
x git checkout develop
x git branch -d feature/MYFEATURE

Push the merged feature branch

gitflow git
N/A git push origin develop
x git push origin :feature/MYFEATURE (if pushed)

Releases

Create a release branch

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

Share a release branch

gitflow git
git flow release publish 1.2.0 git checkout release/1.2.0
x git push origin release/1.2.0

Get latest for a release branch

gitflow git
N/A git checkout release/1.2.0
x git pull --rebase origin release/1.2.0

Finalize a release branch

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

Push the merged feature branch

gitflow git
N/A git push origin master
x git push origin develop
x git push origin --tags
x git push origin :release/1.2.0 (if pushed)

Hotfixes

Create a hotfix branch

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

Finalize a hotfix branch

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

Push the merged hotfix branch

gitflow git
N/A git push origin master
x git push origin develop
x git push origin --tags
x git push origin :hotfix/1.2.1 (if pushed)

Cheatsheet

Cleaning

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment