Skip to content

Instantly share code, notes, and snippets.

@VasylShevchenko
Forked from PavloBezpalov/git_flow.md
Last active November 2, 2018 20:19
Show Gist options
  • Save VasylShevchenko/3a570fd43d3123cdd734e831c2e6eef3 to your computer and use it in GitHub Desktop.
Save VasylShevchenko/3a570fd43d3123cdd734e831c2e6eef3 to your computer and use it in GitHub Desktop.
Pivotal Git Flow

Git Flow

Working on stories

  1. Start story in pivotal tracker and copy it id (STORY_ID).

  2. Checkout development branch and pull from remote

    git checkout development
    git pull origin development
  3. Create working branch from development branch

    STORY_TYPE - feature/bug/chore

    SHORT_DESCRIPTION - meaningful name for branch based on story title

    git checkout -b <STORY_TYPE>/<STORY_ID>_<SHORT_DESCRIPTION> development

    Ex.

    git checkout -b feature/155722581_allow_logo_remove development
  4. Work in branch, commit changes and push to origin

  5. When story completed checkout development branch and pull changes from remote

    git checkout development
    git pull origin development
  6. Merge your branch into development with --no-ff option

    Ex.

    git merge --no-ff feature/155722581_allow_logo_remove
  7. Push changes to remote server

    git push origin development
  8. Delete working branch from development branch

    To delete a local branch.

    git branch -d the_local_branch

    To remove a remote branch (if you know what you are doing!).

    git push origin :the_remote_branch

    Or simply use the new syntax (v1.7.0).

    git push origin --delete the_remote_branch

Fixing production bug

  1. Start story in pivotal tracker and copy it id (STORY_ID).

  2. Checkout master branch and pull from remote

    git checkout master
    git pull origin master
  3. Create working branch from master branch

    STORY_TYPE - bug

    SHORT_DESCRIPTION - meaningful name for branch based on story title

    git checkout -b <STORY_TYPE>/<STORY_ID>_<SHORT_DESCRIPTION> master

    Ex.

    git checkout -b bug/155722581_crash_on_dashboard master
  4. Work in branch, commit changes and push to origin

  5. When story completed checkout master branch and pull changes from remote

    git checkout master
    git pull origin master
  6. Merge your branch into master with --no-ff option

    Ex.

    git merge --no-ff bug/155722581_crash_on_dashboard
  7. Create tag with patch version

    If previous version was 2.2 set new version to 2.2.1, if it was 2.2.1 set to 2.2.2.

    git tag -a 2.2.1 -m '2.2.1'
    git push origin 2.2.1 
  8. Push changes to remote server

    git push origin master
  9. Checkout development branch and pull from remote

    git checkout development
    git pull origin development
  10. Merge your branch into development with --no-ff option

Ex.

git merge --no-ff bug/155722581_crash_on_dashboard
  1. Push changes to remote server

    git push origin development

Creating release

  1. Start story in pivotal tracker and copy it id (STORY_ID).

  2. Checkout development branch and pull from remote

    git checkout development
    git pull origin development
  3. Create working branch from development branch

    STORY_TYPE - release

    SHORT_DESCRIPTION - meaningful name for branch based on story title

    git checkout -b <STORY_TYPE>/<STORY_ID>_<SHORT_DESCRIPTION> development

    Ex.

    git checkout -b release/155722581_monday_5.03.18_release_2.3 development
  4. Checkout master branch and pull from remote

    git checkout master
    git pull origin master
  5. Merge your branch into master with --no-ff option

    Ex.

    git merge --no-ff release/155722581_monday_5.03.18_release_2.3
  6. Create tag with minor version

    If previous version was 2.2 set new version to 2.3, if it was 2.2.1 set to 2.3.

    git tag -a 2.3 -m '2.3'
    git push origin 2.3
  7. Push changes to remote server

    git push origin master
  8. Checkout development branch and pull from remote

    git checkout development
    git pull origin development
  9. Merge your branch into development with --no-ff option

    Ex.

    git merge --no-ff release/155722581_monday_5.03.18_release_2.3
  10. Push changes to remote server

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