How To Use GitLab
How To Use GitLab
How To Use GitLab
What is GitLab?
GitLab is an open-source web-based Git repository that is a complete DevOps platform that
allows professionals to work on all kinds of tasks in a project, such as planning, code
management, monitoring, and security. It empowers team productivity and improves the
product life cycle, which adds value to the customer. GitLab is a DevOps platform that
allows monitoring source code, sharing work on multiple projects, and building more
optimized software.
Git Commands
Let’s check out some basic Git commands that are used to work with Git.
$ git --version
○ To add a Git username to identify the author, use the command below-
$ git add.
○ To view changes in red color and add the file, use the command below-
○ To check the changes made in the file, use the command below-
$ git status
○ To check the entire information list, use the command below-
○ To pull the latest changes to the master branch, use the command below-
○ To fetch the latest changes to the working directory, use the command below
○ To delete all changes, including untracked files, use the command below-
$ git clean -f
○ To merge the different branch with the master branch, use the command
below
1. Open about.gitlab.com
2. If you have an account, Sign in, or else Register.
3. You will get a Welcome page of GitLab
4. Click to create a project where developers work most in GitLab. Here we can create
projects, configure projects, and add files.
5. Creating a group in GitLab helps organize your projects and grants access to
multiple projects more quickly if we have dozens of documents on policies and best
practices for a developing team.
6. Explore Public Projects helps access a massive library of public GitLab projects.
GitLab supports you if you want to access public projects to find out how to organize
or to grab a copy of open source software and contribute.
7. Learn more about GitLab, which helps you access GitLab’s documentation and
guides to using the platform. It helps to create a project using CI/CD pipelines. Now,
let’s see how to create a project.
Likewise, we can push our files, folders, and records into GitLab.
1. We can also create a project using 24 in-built templates from different sources, like
Ruby on Rails, Spring, iOS Swift,.NET Core, and many more.
From the list of available in-built templates, click Preview to view the template
source, and click Use template to start creating the template. The rest of the process
is the same as creating a blank project. []
1. We can import projects from various Git and other sources to GitLab.
1. The group is a collection of projects that helps to manage and organize the projects,
like a folder. It helps to maintain group members access and permissions for each
project in the group. To create a group, follow the steps.
2. Open GitLab, click Groups on the top menu bar, and then click on New group to
create a group
3. You get a create group page; in that, enter your group name and click Create group.
4. The group was successfully created. Now, click on New Project to create projects in
the group.
5. Enter the project name and enable Private visibility level
6. The project Mindmajix has been successfully created.
7. Go back to the groups and check the project has been created
8. We can also add an avatar to our project and group name. Open project, click on
Settings and then click General
9. A general settings page opens. Choose project avatar, select your avatar, and click
Save Changes.
10. You can see the project avatar is updated.
11. We can also add an avatar while creating the project.
Adding users to the group makes for organized work that benefits accessing files. Admin
can restrict the access of the user and can even schedule a time for a deadline to work on
the project. To add users to the group, do the following steps.
As a current owner
As an administrator
In GitLab, an owner is a person who manages the users of the group. So, only users with
the permission of the owner can also manage the group members.
To remove a member from the group, do the following steps:
A fork is a copy of an original repository that we make in the namespace and can apply
changes to later without affecting the original project. It takes a few steps to fork a project in
GitLab.
Create a fork
To create a fork, do the following steps:
1. On the project page, pick a project and click on the fork icon
2. Select the project to create a copy of the project.
3. The project has been forked successfully.
A merge request is a request to merge one branch to another, which means when we
create a new feature, change the files, and push into the GitLab, you need to create a
merge request. This process helps to update the changes made in the copy file and the
original file. To create a merge request, do the following steps.
1. Open projects, click Merge Requests on the project’s dashboard, and then click on
New Merge.
2. You will get a merge page. Select your source branch, click Compare Branch, and
continue.
3. A new merge request page opens. Give all the required details to merge, and click
Submit merge request.
4. A request has been sent to the person to merge the changes in the project.
Removing a fork
In GitLab, we can even remove the fork relationship that helps not to send merge requests
to the upstream project. Only project owners have permission to remove the fork from a
project. To remove a fork, follow the steps below: