Skip to main content

Getting started with gitlab

Inisiasi folder dalam gitlab:

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:

    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

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.