Skip to content

Instantly share code, notes, and snippets.

@matdcooper
Created January 10, 2019 14:50
Show Gist options
  • Save matdcooper/e8c617fb5136d95c11a4f4eeab0ab085 to your computer and use it in GitHub Desktop.
Save matdcooper/e8c617fb5136d95c11a4f4eeab0ab085 to your computer and use it in GitHub Desktop.
Git-Flow Cheat-Sheet

Creating git repo

  • Create directory
  • Go into new directory
  • Create bare repo
    • git init --bare
  • Clone repo somewhere
    • git clone <repo>
  • Go into repo folder
  • Create .gitignore file
  • Commit & push new file
    • git add .gitignore
    • git commit -m "Added .gitignore file"
    • git push

Develop Branch

  • Create branch
    • git branch develop
    • git push -u origin develop

Feature (==bugfix, != hotfix)

Start feature

  • Create branch from develop
    • git checkout develop
    • git checkout -b feature/branch
    • git push --set-upstream origin feature/branch

Finish feature

  • Merge back into develop
    • git checkout develop
    • git merge feature/branch
    • git push

Release

Start release

  • Create branch from develop
    • git checkout develop
    • git checkout -b release/0.1.0

Finish release

  • Merge back into develop
    • git checkout develop
    • git merge release/0.1.0
    • git push
  • Merge back into master
    • git checkout master
    • get merge release/0.1.0
    • git push
  • Create tag from master
    • git checkout master
    • git tag v0.1.0
    • git push origin v0.1.0
  • Delete feature branch
    • git branch -d feature/branch
    • git push origin --delete feature/branch
  • Delete release branch
    • git branch -d release/0.1.0
    • git push origin --delete release/0.1.0

Hotfix

Start

  • Create branch from master
    • git checkout master
    • git checkout -b hotfix/branch

Finish

  • Merge into master
    • git checkout master
    • git merge hotfix/branch
    • git push
  • Merge into develop
    • git checkout develop
    • git merge hotfix/branch
    • git push
  • Delete hotfix branch
    • git -d hotfix/branch
    • git push origin --delete hotfix/branch
  • Create tag from master
    • git checkout master
    • git tag v0.1.1
    • git push origin v0.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment