Objectives
To ensure users are well-equipped on how to manage projects with Gitlab.
Prerequisites
- Basic Git command knowledge (Pull, push, clone)
- Gitlab Account
Steps
Step 1: Create a Project Group
On the GUI, select Create a group.
Group name > *your group details*
Group URL > http://gitlab.netonboard.com/*auto-generated*
Group description > *Optional*
Group avatar > *Avatar*
Visibility level > Private/Internal/Public
Finally, hit Create Group
Next, select Members
Search for the name of the user you want to add.
Select the role.
[OPTIONAL] Select user’s membership expiration date.
Finally, select Add to Group.
Step 2: Create a Group Project
In your group, select New project.
Project Name > *your project name*
Project URL > http://gitlab.netonboard.com/*name-of-the-group*
Project slug > *your project slogan*
Visibility Level > Private/Internal/Public
Finally, hit Create Project.
Once completed, you will be directed to the project’s empty repository. Here, you may push an existing project from your local computer.
Step 3: Create Branches
Method 1: Via Terminal
[Optional] git branch – to check which branch are you currently on.
git checkout -b new_branch_name
Edit, add, and commit your files. (Refer to GITLAB_BASIC_COMMANDS)
git push <project-url> new_branch_name
Method 2: Via Web GUI
On your project repo, select + icon.
Select New branch
Specify a Branch name
Under Create from, choose a source branch. The newly created branch will duplicate files which are based on the selected source branch.
To enable push commands to the branch, create the same branch on your local machine and do a pull command.
Step 3: Switching between branches
[OPTIONAL] git branch / git status – to check which branch are you currently on.
git checkout local_branch
Step 4: Renaming a Branch and Update to Remote Repo
git checkout local_branch
git push <project url> :master
git push <project url> developer
Step 5: Fork a Project
Select the Fork button located on the project’s Details screen
Select a namespace to fork to.
NOTE: namespaces only include groups or your own namespace)
Step 6: Merge Requests
On your forked project, select Create merge request.
Enter a title
[Optional] Enter a Description
Choose an Assignee
Select Change Branches
Make sure the Source branch is pointing to the forked project and on the correct branch
On the Target branch, make sure you are pointing to the original project
Select Compare branches and continue
Select Submit merge request
Depending on the assignee (Maintainers / Owner), that member will receive the merge request for approving
To approve, select Merge
Files which are originally from the forked project will be placed under the destination branch specified in the merge request
Step 7: Revert a Commit (Rollback)
Under Repository, select Commits
Select a commit from the list.
Select Options
Select Revert
Select a branch you want to store the reverted changes to.
Make sure the Start a new merge request with these changes option is checked, and select Revert.
Select Submit merge request.
Finally, select Merge