Skip to content

Instantly share code, notes, and snippets.

@VitorTheGreat
Last active December 23, 2021 14:37
Show Gist options
  • Save VitorTheGreat/eae501b6d908ef56c588417d6ad32f6a to your computer and use it in GitHub Desktop.
Save VitorTheGreat/eae501b6d908ef56c588417d6ad32f6a to your computer and use it in GitHub Desktop.
Git Flow Basics

GitFlow Basics

  1. Start a new repository with support for the branching model(gitFlow)

    git flow init
    

    obs: git flow automatically changes the branch to develop, we are going to work on this branch.
    *It will ask you the name of the branches that yo want to work. It is recommended to use the defaults, for it makes sense

  2. Create a feature branch

      git flow feature start <BRANCH>
    

    obs: * After finished your feature use git basic commands to add and commit ->

      git add .
      git commit -m "COMMENT"
      git push #(optional: git flow feature publish <BRANCH>) (publish to remote 'origin')
    
  3. After finishing everything on your feature we should push it to the develop

    git flow feature finish <BRANCH>
    

    obs: git flow automatically merge the FEATURE Branch and checkout/change to the DEVELOP Branch.
    Now your feature is on DEVELOP branch and you can test it

  4. After tested your feature on DEVELOP Branch you should publish the update to MASTER Branch

    git flow release start <VERSION> (e.g. git flow release start 0.0.1)
    

    obs: * Remember to study the Semantic Versioning where:

    • First number: Incompatible Changes on the software/API
    • Second number: Functionalities keeping the compatibility of the software/API
    • Third Number: Correction bugs keeping the compatibility of the software/API
    • WARN: we can make little changes in the RELEASE Branch, but it is not usual, the RELEASE Branch is immediately merged to the MASTER Branch
  5. When done with the last-minute fixes(or not) you should finish it

    git flow release finish <VERSION> (e.g. git flow release finish 0.0.1)
    

    obs: * git flow automatically merge it to the DEVELOP Branch and MASTER Branch. It will open the text editor three times:

    1st: to edit the commit related to the merge between RELEASE Branch VESRION and MASTER Branch
    2nd: to edit the description of the VERSION Tag, that will be created by git flow to make the version changes easier
    3rd: to edit the text of the merge related to the merge between MASTER Branch and the DEVELOP Branch.

    • It is recommended to let the default text on 1st and 3rd time, at the 2nd time(it is mandatory) to describe the VERSION TAG (I usually write the tag).
      It will delete the RELEASE Branch locally and checkout/change to master branch
  6. After all this, push the master and develop to update the remote repository

    git push
    

    obs: on both branches, master and develop!

Found any errors? be free to correct and warn me, please: vitor.services@gmail.com

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