Skip to content

Instantly share code, notes, and snippets.

@jms
Forked from JamesMGreene/gitflow-breakdown.md
Created April 29, 2020 15:39
Show Gist options
  • Save jms/0715f64dd058d3b2e850b2a55944c4b5 to your computer and use it in GitHub Desktop.
Save jms/0715f64dd058d3b2e850b2a55944c4b5 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
git commit --allow-empty -m "Initial commit"
git checkout -b develop

With gitflow:

git flow init

With raw git:

# Make this directory into a git repo
git init 
# Now in `master` branch

# Make an initial commit for the sake of commit tracking (history, branching, etc.)
git commit --allow-empty -m "Initial commit"

# Create a `develop` branch from `master` and then check it out
git checkout -b develop

Connect to the remote repository

With gitflow and/or raw git:

# Add the remote repo URL
git remote add origin [email protected]:MYACCOUNT/MYREPO

Create a feature branch

git flow feature start MYFEATURE

git checkout -b MYFEATURE develop # Create a MYFEATURE branch from develop and the check it out



```sh
git flow feature publish MYFEATURE


git push origin MYFEATURE
git flow feature pull origin MYFEATURE


git pull origin MYFEATURE  # ????
git flow feature finish MYFEATURE


git checkout develop         # Checkout the `develop` branch
git merge --no-ff MYFEATURE  # Merge the `MYFEATURE` branch into `develop`. `--no-ff` creates a merge commit.
git branch -d MYFEATURE      # Delete the `MYFEATURE` branch
git push origin develop      # Push the `develop` branch to remote
git flow release start 1.2.0


git checkout -b release-1.2.0 develop
# (Run some commands to update the version)
git commit -a -m "Bumped version number to 1.2.0"
git flow release publish 1.2.0


git push origin release-1.2.0
git flow release finish 1.2.0


git checkout master
git merge --no-ff release-1.2.0
git branch -d release-1.2.0
git tag -a 1.2.0
git push --tags


git push origin master --tags
git flow hotfix start 1.2.1 [master|develop]


git checkout -b hotfix-1.2.1 [master|develop]
git flow hotfix finish 1.2.1


git checkout develop
git merge --no-ff hotfix-1.2.1
git checkout master
git merge --no-ff hotfix-1.2.1
git branch -d hotfix-1.2.1
git tag -a 1.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment