> For the complete documentation index, see [llms.txt](https://se-group-3.gitbook.io/se-group-3-project-workflow/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://se-group-3.gitbook.io/se-group-3-project-workflow/git-workflow/git-workflow.md).

# Git Workflow

## Why are we creating a Git Workflow?

1. To avoid octopus merging
2. To review incoming pull request in order to avoid deletion of files or adding junk files
3. Smoother workflow and avoid git conflicts

{% stepper %}
{% step %}

### Navigate to the Project's GitHub page

Go to the project’s GitHub page: Open GitHub in your browser and navigate to our [project repository.](https://github.com/ICS26010-group-3/twin-cj)

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2FpIQJzGpiibIFjJIFb8wX%2Fimage.png?alt=media&amp;token=c6eccb21-bd04-493f-98dc-ffbfc37f2728" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Open the `Projects` tab

Click on the Projects tab and select on `Twin CJ Glamping Resort Development`&#x20;

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2Ff64yozHaMzf1KiJW2Nyr%2F1.png?alt=media&amp;token=5cd3d27d-892a-46f8-ac2e-189dba24c39b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select and Assign Your Task

1. **Click on the task assigned to you:** Locate your task in the project’s Kanban or issues list.
2. **Assign the task to yourself:** In the task details, find the assignment section and set yourself as the assignee.

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2F39ZFKvOxxlF6I4s0OYpY%2F2.png?alt=media&amp;token=a1c46bf9-1840-4718-b1fb-b56d23d2c932" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Convert Task to Issue

* **Click “Convert to Issue.”** This option is located in the task’s details.&#x20;

For easier documentation, we recommend you type in updates in your issues The issue ticket can also be used to ask questions and communicate with team members. The issue ticket can also be used to bring up issues/bugs regarding the issue ticket. (Please be formal, as this would be viewed by future developers

<div data-full-width="false"><figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2F9EE0qsEdYUYpKe4PmOHD%2F4.png?alt=media&amp;token=c8f903e6-bf37-407b-92a1-e091b3ec37c6" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
You can make issues/pull requests of fixes besides the complete feature. For example you haven't finished the navbar, but you want this font change to be pushed to the main branch, you can then create an issue ticket for it and well merge it
{% endhint %}

* **Choose our project repository:** Ensure you select the correct repository to link with the task.&#x20;
* **Click on “Create a Branch”:** Start a new branch linked to this issue.
  {% endstep %}

{% step %}

### Set Up Your Branch

1. **Check the branch name:** Verify that the branch follows the format below:&#x20;
   1. Branch name format: `<issue_number>-<task_name>`&#x20;
   2. Example: `5-create-main-menu`&#x20;
2. **Ensure `Checkout locally` is checked or `Open branch with GitHub Desktop`:** This will prepare the branch for local work.
3. **Set Branch Source:** Confirm that the branch source is set to **`development`**, ensuring you're working on the latest version
4. **Click `Create Branch`:** Confirm your branch creation.

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2FYupKFbxlUvziX2ykOa3d%2F5.png?alt=media&amp;token=decc3d84-ae16-4928-b3a5-00f2f9f3e4f1" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}

### Copy Git Commands

Copy the provided commands: These will be used to set up the branch locally.

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2FUJd8p7XXkdBLFmy6zYsu%2F6.png?alt=media&amp;token=c399d4b4-8ab8-4032-8823-06d6ed3d31fc" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Open Your IDE and Set Up the Branch

1. **Open Visual Studio Code:** Go to your project directory in the IDE.&#x20;
2. Switch to the development branch: Ensure you are on the `development` branch. If not, run the following command in the terminal:

```
git checkout development
```

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2F0XNQCTVwE9nFpRqdguwQ%2F8.png?alt=media&amp;token=6d31fefd-39fa-4583-b6bf-d6a7298cb6fe" alt=""><figcaption></figcaption></figure>

1. **Paste the commands in the terminal:** This will create and switch to your new branch.&#x20;
2. **Verify the branch:** Ensure your current working branch matches the one created in GitHub.

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2FJ6noNQt2MtuNtI03NfR1%2F7.png?alt=media&amp;token=6baabb87-fa5f-44e2-856b-16022b44af28" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Start Coding!

Check the[ ](/se-group-3-project-workflow/project-coding-guidelines/editor.md)Project Coding Guidelines section for a guide on our project guidelines&#x20;
{% endstep %}

{% step %}

### Commit and Push Changes

1. **Stage and commit your changes:** After coding, stage and commit your changes with a meaningful commit message.

Example:&#x20;

```
git add <path-of-changed-file>
git commit -m "Add main menu component"
```

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2FFZCHrO6W1rFBf6o5loOy%2F9.png?alt=media&amp;token=5cb5cee3-8432-44da-a204-d35e5230ebd1" alt=""><figcaption></figcaption></figure>

2. Push to the remote branch: Run the following command to push your branch to the repository.

```
git push -u origin <name_of_branch>
```

{% hint style="warning" %}
Replace \<name\_of\_branch> with the actual branch name, e.g., 5-create-main-menu.
{% endhint %}

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2FpPsYx9Qak0cIoO2nclx4%2F10.png?alt=media&amp;token=2bd7d292-32c7-4a51-b0bf-835977035c51" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Creating a Pull Request

1. Navigate to GitHub Repository: Go to the project's [GitHub page.](https://github.com/ICS26010-group-3/twin-cj)
2. Initiate Pull Request
3. Click the `Compare & Pull Request` button next to your branch

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2FCMXI9Tqsu03xrvfxT4XY%2F13.png?alt=media&amp;token=81d68804-faa1-4ecc-ae60-4f8ad8752c69" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}

* If the button doesn't appear, click on the Pull Requests tab, then select New Pull Request.&#x20;
  {% endhint %}

4. In the pull request setup, select your branch as the one you want to merge into the <mark style="color:yellow;">`development branch`</mark>&#x20;

<figure><img src="https://169348336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKOxpdip4vm4BcZaZBkGb%2Fuploads%2Fr8gyr7gvMKjLoMFb8SOr%2F14.png?alt=media&amp;token=cee4b02b-a237-4082-b06b-ddee92f93d8b" alt=""><figcaption></figcaption></figure>

5. **Create a Pull Request**

{% hint style="danger" %}
DO NOT CLICK THE `MERGE BUTTON` .
{% endhint %}

{% endstep %}
{% endstepper %}
