## ElkTech Git Work Flow The following outlines the SOPs that should be followed when working on any ElkTech project with a Git remote repository: 1. Clone the repository `git clone <repository-url>` 2. Initialize Git Flow in your local repository `git flow init`. Use `master` branch for production releases, `develop` branch for next releases, **feature** prefix for `feature` branches and **bugfix** prefix for `bugfix` branches. 3. Go to **Boards** of the project choose any issue from **To Do** lane that you want to work on and move it to **doing** lane. 4. Look in the issue tags if the issue has any of the following 3 labels and than run the corresponding command to set up your local branching: * **feature:** This means that a new feature needs to be added into the project. Run the following command: `git flow feature start <issue#>` Replace `issue#` with the actual issue number you are working on. for example if an issue number is 54 and it has a label feature in it you will run the following command: `git flow feature start 54` **This action creates a new feature branch based on 'develop' and switches to it** * **bugfix** This means that a bug needs to be fixed in the project which should be merged into develop. Run the following command: `git flow bugfix start <issue#>` Replace `issue#` with the actual issue number you are working on. for example if an issue number is 54 and it has a label bugfix in it you will run the following command: `git flow bugfix start 54` **This action creates a new feature branch based on 'develop' and switches to it** 5. Now you can commit your code and changes for as long as you want first stage them with: `git add .` and after that you can commit with `git commit -m "<my-message> #<issue#>"` Replace `issue#` with the actual issue number you are working on. for example if an issue number is 54 and it has a label bugfix in it you will run the following command: `git commit -m "feature login added #54"` 6. When you are done with the work you can push it easily with following commands: * **feature:** Use the below command to push your changes to remote `git flow feature publish <issue#>` Replace `issue#` with the actual issue number you are working on. for example if an issue number is 54 and it has a label feature in it and you want to push your local changes to remote so that others can test it, you will run the following command: `git flow feature publish 54` * **bugfix:** Use the below command to push your changes to remote `git flow bugfix publish <issue#>` Replace `issue#` with the actual issue number you are working on. for example if an issue number is 54 and it has a label feature in it and you want to push your local changes to remote so that others can test it, you will run the following command: `git flow bugfix publish 54` 7. Add the label "review" present in the repository to the ticket. Let's say if you were working on issue *54* than add "review" label to the ticket in the gitlab repository. 8. Create a merge request for the changes and assign it to your relevant maintainer for review. 9. See if there are any merge conflicts in your merge request and fix them if they are fixable by you otherwise contact your team lead. 10. **Only for Maintainers** Review the merge request by the software Engineer If something needs to be changed add the comments on merge request and reject it. If everything is okay than close the ticket. That's it now you are done. Go back to step 3 and repeat this process until there is no ticket assigned to you. Some notes to remember when working on a project: 1. Always use comments on tickets to ask for any clarifications regarding the ticket or giving any update. 2. When working on a ticket only work within the scope of that ticket. You are not work on anything else otherwise it disturbs the merging of code and make collaborative work hard. 3. You are only allowed to work on tickets that have a label **To Do**. Do not work on any ticket that do not have this label.