# Getting started with gitlab

Inisiasi folder dalam gitlab:

```bash
cd existing_repo
git remote add origin https://gitlab.com/sandihex/sims-server.git
git branch -M main
git push -uf origin main
```

To fetch and synchronize your local repository with the `main` branch from the remote repository on GitLab, follow these steps:

1. **Fetch the latest changes from the remote repository:**
    
    ```
    git fetch origin
    ```
2. **Reset your local `main` branch to match the remote `main` branch:**
    
    <div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium"><div class="overflow-y-auto p-4" dir="ltr">``</div></div>```
    git reset --hard origin/main
    ```
    
    This command will force your local `main` branch to match the state of the `main` branch on the remote repository, discarding any local changes.
3. **Ensure you are on the `main` branch:**
    
    ```
    git checkout main
    ```
    
    <div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium"><div class="overflow-y-auto p-4" dir="ltr">``</div></div>

By following these steps, your local repository will be synchronized with the `main` branch on the remote GitLab repository. If you have any local changes you want to keep, make sure to commit or stash them before running these commands.