Title: Demonstrating Version Control with GitLab
The objective of this experiment is to showcase the basic functionalities of version control using GitLab. We will create a simple project, set up a GitLab repository, and perform version control operations such as creating branches, making changes, committing changes, and merging branches.
Tools and Technologies:
GitLab Community Edition (CE)
Git (command-line or Git GUI client)
Step 1: Set Up GitLab Repository
Create a new project/repository on GitLab.
Clone the repository to your local development environment using Git.
Step 2: Initialize the Project
Create a new directory for the project on your local machine.
Initialize a Git repository in this directory using the command: git init.
Step 3: Configure Git Remote
Set the GitLab repository as the remote for your local repository using the command: git remote add origin <GitLab_Repository_URL>.
Step 4: Create and Switch Branches
Create a new branch called "feature-branch" using the command: git checkout -b feature-branch.
Switch back to the main branch (usually "master" or "main") using: git checkout main.
Step 5: Make Changes and Commit
Create a new file or modify an existing one in your project directory.
Add the changes to the staging area using: git add <file_name>.
Commit the changes with a descriptive message using: git commit -m "Your commit message".
Step 6: Push Changes to GitLab
Push the committed changes to the GitLab repository using: git push origin <branch_name> (e.g., git push origin main).
Step 7: Merge Branches
Switch to the main branch using: git checkout main.
Merge the "feature-branch" into the main branch using: git merge feature-branch.
Resolve any merge conflicts if they occur.
Commit the merge changes and push them to the GitLab repository.
Step 8: Review History
View the commit history using: git log.
Use GitLab's web interface to visualize the commit history, branches, and merge requests.
Step 9: Optional - Collaborate with Others
Invite collaborators to your GitLab repository.
Ask collaborators to clone the repository, make changes, and push them to GitLab.
Review and merge their changes using merge requests.