GitLab – Create a Branch

GitLab – Create a Branch ”; Previous Next Description Branch is independent line and part of the development process. The creation of branch involves following steps. Creating a Branch Step 1 − Login to your GitLab account and go to your project under Projects section. Step 2 − To create a branch, click on the Branches option under the Repository section and click on the New branch button. Step 3 − In the New branch screen, enter the name for branch and click on the Create branch button. Step 4 − After creating branch, you will get a below screen along with the created branch. Print Page Previous Next Advertisements ”;

GitLab – Import Repository

GitLab – Import Repository ”; Previous Next In this chapter, we will discuss about how to import a repository from Bitbucket to GitLab − Step 1 − Login to your GitLab account and click on the New project button in the dashboard − Step 2 − Click on the Bitbucket button under Import project tab − Step 3 − Next, you need to login to your Bitbucket account. If you don”t have an account, then create a new account by clicking on Sign up link and then login to Bitbucket account. Step 4 − When you click on the Bitbucket button (shown in step 2), it will display the below screen and click on the Grant access button − You need to grant the access to read the account information, repository issues, project settings, and modify the repositories. Step 5 − Click on the Import button to import the project from Bitbucket − Step 6 − After importing the project successfully, it will display the status as Done − Print Page Previous Next Advertisements ”;

GitLab – CI/CD

GitLab – CI/CD ”; Previous Next Description GitLab CI (Continuous Integration) service is a part of GitLab that build and test the software whenever developer pushes code to application. GitLab CD (Continuous Deployment) is a software service that places the changes of every code in the production which results in every day deployment of production. The following points describe usage of GitLab CI/CD − It is easy to learn, use and scalable. It is faster system which can be used for code deployment and development. You can execute the jobs faster by setting up your own runner (it is an application that processes the builds) with all dependencies which are pre-installed. GitLab CI solutions are economical and secure which are very flexible in costs as much as machine used to run it. It allows the project team members to integrate their work daily, so that the integration errors can be identified easily by an automated build. Print Page Previous Next Advertisements ”;

GitLab – Wiki Pages

GitLab – Wiki Pages ”; Previous Next Description Wiki is a system for maintaining documentation for a project in the GitLab. It is like a Wikipedia which can be editable and given permissions to manage the wiki pages. A Guest can view a wiki page and Developer can create and edit a wiki page. Steps for Creating Wiki Page Step 1 − Login to your GitLab account, go to your project and click on the Wiki tab − Step 2 − Now enter the title, format, fill the content section, add a commit message and then click on the Create page button − Step 3 − You will get newly created wiki page as shown in the below image − Print Page Previous Next Advertisements ”;

GitLab – Merge Requests

GitLab – Merge Requests ”; Previous Next Description Merge request can be used to interchange the code between other people that you have made to a project and discuss the changes with them easily. Steps for Merging Request Step 1 − Before creating new merging request, there should be a created branch in the GitLab. You can refer this chapter for creating the branch − Step 2 − Login to your GitLab account and go to your project under Projects section − Step 3 − Click on the Merge Requests tab and then click on the New merge request button − Step 4 − To merge the request, select the source branch and target branch from the dropdown and then click on the Compare branches and continue button as shown below − Step 5 − You will see the title, description and other fields such as assigning user, setting milestone, labels, source branch name and target branch name and click on the Submit merge request button − Step 6 − After submitting the merge request, you will get a new merge request screen as shown below − Print Page Previous Next Advertisements ”;

GitLab – Referencing Issues

GitLab – Referencing Issues ”; Previous Next GitLab can be able to refer the specific issue from the commit message to solve a specific problem. In this chapter, we will discuss about how to reference a issue in the GitLab − Step 1 − To reference a issue, you need to have an issue number of a created issue. To create an issue, refer the creating issue chapter. Step 2 − To see the created issue, click on the List option under Issues tab − Step 3 − Before making the changes in your local repository, check whether it is up to date or not by using the below command − git checkout master && git pull The git pull command downloads the latest changes from the remote server and integrates directly into current working files. Step 4 − Now, create a new branch with the name issue-fix by using the git checkout command − git checkout -b issue-fix Step 5 − Now, add some content to the README.md file to fix the bug − echo “fix this bug” >> README.md Step 6 − Enter the commit message for the above change with the below command − git commit -a This command opens the below screen and press Insert key on the keyboard to add a commit message for the issue-fix branch. Now press the Esc key, then colon(:) and type wq to save and exit from the screen. Step 7 − Now push the branch to remote repository by using the below command − git push origin issue-fix Step 8 − Login to your GitLab account and create a new merge request. You can refer the merge request chapter for the creation of merge request. Step 9 − Once you create the merge request, you will be redirected to the merge request page. When you click on the Close merge request button (refer the screenshot in the step (6) of merge request chapter), you will see the Closed option after closing merge request. Print Page Previous Next Advertisements ”;

GitLab – Rebase Operation

GitLab – Rebase Operation ”; Previous Next Description Rebase is a way of merging master to your branch when you are working with long running branch. Steps for Rebase Operation Step 1 − Go to your project directory and create a new branch with the name rebase-example by using the git checkout command − The flag -b indicates new branch name. Step 2 − Now, create a new file and add some content to that file as shown below − The content ”Welcome to Tutorialspoint” will be added to the rebase_file.md file. Step 3 − Add the new file to working directory and store the changes to the repository along with the message (by using the git commit command) as shown below − The flag -m is used for adding a message on the commit. Step 4 − Now, switch to the ”master” branch. You can fetch the remote branch(master is a branch name) by using the git checkout command − Step 5 − Next, create an another new file, add some content to that file and commit it in the master branch. Step 6 − Switch to the rebase-branch to have the commit of master branch. Step 7 − Now, you can combine the commit of master branch to rebase-branch by using the git rebase command − Print Page Previous Next Advertisements ”;

GitLab – User Permissions

GitLab – User Permissions ”; Previous Next In this chapter, we will discuss about user permissions in the project. Steps for creating User Permissions Step 1 − Login to your GitLab account and click on the Members option under Settings tab − Step 2 − It will open the below screen to add the member to your project − Step 3 − You will see the different types of permissions when you click on a dropdown under Choose a role permission section − You can see the Adding users chapter for setting user permission and adding user to project. Here, we will briefly discuss about different user permissions which can be applied to projects. The following table shows available permission levels for different types of users − S.N. Guest Reporter Developer Master 1 Creates a new issue Creates a new issue Creates a new issue Creates a new issue 2 Can leave comments Can leave comments Can leave comments Can leave comments 3 Able to write on project wall Able to write on project wall Able to write on project wall Able to write on project wall 4 – Able to pull project code Able to pull project code Able to pull project code 5 – Can download project Can download project Can download project 6 – Able to write code snippets Able to write code snippets Able to write code snippets 7 – – Create new merge request Create new merge request 8 – – Create new branch Create new branch 9 – – Push and remove non protected branches Push and remove non protected branches 10 – – Includes tags Includes tags 11 – – Can create, edit, delete project milestones Can create, edit, delete project milestones 12 – – Can create or update commit status Can create or update commit status 13 – – Write a wiki Write a wiki 14 – – Create new environments Create new environments 15 – – Cancel and retry the jobs Cancel and retry the jobs 16 – – Updates and removes the registry image Updates and removes the registry image 17 – – – Can add new team members 18 – – – Push and remove protected branches 19 – – – Can edit the project 20 – – – Can manage runners, job triggers and variables 21 – – – Add deploy keys to project 22 – – – Able to manage clusters 23 – – – Configure project hooks 24 – – – Can enable/disable the branch protection 25 – – – Able to rewrite or remove Git tags Print Page Previous Next Advertisements ”;

GitLab – Squashing Commits

GitLab – Squashing Commits ”; Previous Next Description Squashing is a way of combining all commits into one when you are obtaining a merge request. Steps for Squashing Commits Step 1 − Go to your project directory and check out a new branch with the name squash-chapter by using the git checkout command − The flag -b indicates new branch name. Step 2 − Now, create a new file with two commits, add that file to working directory and store the changes to the repository along with the commit messages as shown below − Step 3 − Now, squash the above two commits into one commit by using the below command − $ git rebase -i HEAD~2 Here, git rebase command is used to integrate changes from one branch to another and HEAD~2 specifies last two squashed commits and if you want to squash four commits, then you need to write as HEAD~4. One more important point is, you need atleast two commits to complete the squash operation. Step 4 − After entering the above command, it will open the below editor in which you have to change the pick word to squash word in the second line (you need to squash this commit). Now press the Esc key, then colon(:) and type wq to save and exit from the screen. Step 5 − Now push the branch to remote repository as shown below − Print Page Previous Next Advertisements ”;

GitLab – Milestones

GitLab – Milestones ”; Previous Next Description Milestones are used for arranging issues and merge requests into a determined group which can achieved within a specified amount of time by setting a start and due date. Steps for Creating Milestones Step 1 − Login to your GitLab account, go to your project and click on the Milestones option under Issues tab − Step 2 − Click on the New milestone button − Step 3 − Now enter the title, description, start and due date and click on Create milestone button as shown in the below image − Step 4 − After creating a milestone, it will display a message saying ”Assign some issues to this milestone” as shown below − Step 5 − Now go to Issues tab and click on the New issue button to create an issue for the milestone − Step 6 − Now, fill the information such as title, description and if you want, you can select a user to assign an issue, milestone, labels upon operation or could be choose by developers themselves later. Click on the Submit issue button. Step 7 − After creating a issue, you will get overview of an issue along with title and description. At right side, click on Edit option and assign milestone for the issue under Milestone section − Step 8 − Now go back to Milestones section and you will see the added milestone along with created issue − Print Page Previous Next Advertisements ”;