Skip to content

Instantly share code, notes, and snippets.

@matdcooper
Created January 10, 2019 14:50
Show Gist options
  • Select an option

  • Save matdcooper/e8c617fb5136d95c11a4f4eeab0ab085 to your computer and use it in GitHub Desktop.

Select an option

Save matdcooper/e8c617fb5136d95c11a4f4eeab0ab085 to your computer and use it in GitHub Desktop.

Revisions

  1. matdcooper created this gist Jan 10, 2019.
    92 changes: 92 additions & 0 deletions gitflow-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,92 @@
    # 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`