____________

### 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

    ```bash
    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
    ```bash
    git checkout -b <STORY_TYPE>/<STORY_ID>_<SHORT_DESCRIPTION> development
    ```

    Ex.
    ```bash
    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

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

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

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

    To delete a local branch.
    ```bash
    git branch -d the_local_branch
    ```
    
    To remove a remote branch (if you know what you are doing!).
    ```bash
    git push origin :the_remote_branch
    ```    
    
    Or simply use the new syntax (v1.7.0).
    ```bash
    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

    ```bash
    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
    ```bash
    git checkout -b <STORY_TYPE>/<STORY_ID>_<SHORT_DESCRIPTION> master
    ```

    Ex.
    ```bash
    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
   
   ```bash
   git checkout master
   git pull origin master
   ```
6. Merge your branch into master with --no-ff option

   Ex.
   ```bash
   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.

   ```bash
   git tag -a 2.2.1 -m '2.2.1'
   git push origin 2.2.1 
   ```
8. Push changes to remote server
   
   ```bash
   git push origin master
   ```
9. Checkout development branch and pull from remote

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

   Ex.
   ```bash
   git merge --no-ff bug/155722581_crash_on_dashboard
   ```
11. Push changes to remote server

    ```bash
    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

    ```bash
    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
    ```bash
    git checkout -b <STORY_TYPE>/<STORY_ID>_<SHORT_DESCRIPTION> development
    ```

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

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

   Ex.
   ```bash
   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.

   ```bash
   git tag -a 2.3 -m '2.3'
   git push origin 2.3
   ```
7. Push changes to remote server
   
   ```bash
   git push origin master
   ```
8. Checkout development branch and pull from remote

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

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

    ```bash
    git push origin development
    ```