Open In App

Managing Git Repositories with GitLab

Last Updated : 25 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

GitLab is a powerful platform for managing Git repositories, offering a list of features that provide collaboration, code review, continuous integration/continuous deployment (CI/CD), and more. This guide will walk you through Managing Git Repositories with GitLab.

How to Access GitLab?

GitLab is a SCM tool where we can store and manage our source code.

Step 1: Signing In to GitLab

GitLab provide various options to sign in through its sign-in page.

1. Click here to access GitLab sign-in page.

2. You can opt for username-password sign-in or through Google, Github, BitBucket or Salesforce accounts. We'll be moving on with Google sign in to facilitate our sign up process.

Gitlab_SignIn_Page_1_optimized
Gitlab Sign in page

Step 2: Group & Project Creation

1. You can select the options as provided in the screenshot below for the reference. After filling up the information, click on Continue to move forward.

Gitlab_welcome_screen_6_optimized
Gitlab Welcome Screen

2. You will be redirected to a page to create or import project. Project name is for the name we want to give to our project. For now, I have kept it to learn-gitlab. You can add anything here. Keep the checkbox checked to include readme file in the project. After that hit on Create Project button at bottom.

Create_project_optimized
Create new project in GitLab

3. You will be redirected to getting started page. Click on Ok. Let's go to continue.

Getting_started_page_optimized
Getting Started Page

4. Congratulations! You have created your first repository in GitLab. Yes, it's as easy as this. Next, we'll see how to add file to our newly created repository.

Repository_home_screen_2_optimized

Uploading a code file in the repository

A repository can be considered as group of files, often time code files stored in a cloud location. For the purpose to make the learning simple, I have created a basic html file locally which I want to push in the repository I have created.

Step 1: To add the file, click on the + icon as shown the. screenshot below.

upload_file_optimized
Upload file

Step 2: You will be prompted to upload file. Select and click on Upload.

upload_file_prmpt_2_optimized
Upload file prompt

Step 3: Once you click on Upload File, you will get a prompt of file successfully uploaded and you will get to see your uploaded file there.

uploaded_file_on_gitlab_1_optimized

Creating a new Branch

Branches are the way to help different developers work on the same piece of code without affecting other's code. Later on, they can combine the changes in a single branch through process called merging. You can see the available branches in your project, create or delete branches by following the steps below -

Step 1: Click on the branches option in side navigation as shown in the below screenshot.

selech_branches_optimized
Select Branches

Step 2: You can now see that there is single main branch there. We will now create a new dev branch to work on our piece of code. Click on New Branch button.

Step 3: On the new screen appearing, give dev as branch name and keep main as it is in Create from dropdown. It will create a new branch which will be exactly same as the main branch. Click on Create Branch.

new_branch_optimized
New Branch creation page

Step 4: Branch will be successfully created and you will be redirected to new branch content as in the screenshot below.

branch_created_2_optimized
Newly created branch

Next Article
Article Tags :

Similar Reads

  翻译: