Skip to main content

Experiment to Demonstrating Version Control with GitLab

 Title: Demonstrating Version Control with GitLab


Objective:

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)

  • Web browser


Experiment Steps:

Step 1: Set Up GitLab Repository

  1. Create a new project/repository on GitLab.

  2. Clone the repository to your local development environment using Git.

Step 2: Initialize the Project

  1. Create a new directory for the project on your local machine.

  2. Initialize a Git repository in this directory using the command: git init.

Step 3: Configure Git Remote

  1. 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

  1. Create a new branch called "feature-branch" using the command: git checkout -b feature-branch.

  2. Switch back to the main branch (usually "master" or "main") using: git checkout main.

Step 5: Make Changes and Commit

  1. Create a new file or modify an existing one in your project directory.

  2. Add the changes to the staging area using: git add <file_name>.

  3. Commit the changes with a descriptive message using: git commit -m "Your commit message".

Step 6: Push Changes to GitLab

  1. Push the committed changes to the GitLab repository using: git push origin <branch_name> (e.g., git push origin main).

Step 7: Merge Branches

  1. Switch to the main branch using: git checkout main.

  2. Merge the "feature-branch" into the main branch using: git merge feature-branch.

  3. Resolve any merge conflicts if they occur.

  4. Commit the merge changes and push them to the GitLab repository.

Step 8: Review History

  1. View the commit history using: git log.

  2. Use GitLab's web interface to visualize the commit history, branches, and merge requests.

Step 9: Optional - Collaborate with Others

  1. Invite collaborators to your GitLab repository.

  2. Ask collaborators to clone the repository, make changes, and push them to GitLab.

  3. Review and merge their changes using merge requests.

Conclusion:

This experiment demonstrates the fundamental version control operations using GitLab. By following these steps, you have gained an understanding of how to set up a repository, create branches, make changes, commit changes, merge branches, and collaborate with others using GitLab's version control capabilities. Version control plays a crucial role in enabling teams to collaborate efficiently and manage changes in software development projects effectively.

Comments

Popular posts from this blog

Experiment No. 5 Title: Applying CI/CD Principles to Web Development Using Jenkins, Git, and Local HTTP Server

  Experiment No. 5 Title: Applying CI/CD Principles to Web Development Using Jenkins, Git, and Local HTTP Server  Objective: The objective of this experiment is to set up a CI/CD pipeline for a web development project using Jenkins, Git, and webhooks, without the need for a Jenkinsfile. You will learn how to automatically build and deploy a web application to a local HTTP server whenever changes are pushed to the Git repository, using Jenkins' "Execute Shell" build step. Introduction: Continuous Integration and Continuous Deployment (CI/CD) is a critical practice in modern software development, allowing teams to automate the building, testing, and deployment of applications. This process ensures that software updates are consistently and reliably delivered to end-users, leading to improved development efficiency and product quality. In this context, this introduction sets the stage for an exploration of how to apply CI/CD principles specifically to web development using J

Experiment No. 6 Title: Exploring Containerization and Application Deployment with Docker

  Experiment No. 6 Title: Exploring Containerization and Application Deployment with Docker  Objective: The objective of this experiment is to provide hands-on experience with Docker containerization and application deployment by deploying an Apache web server in a Docker container. By the end of this experiment, you will understand the basics of Docker, how to create Docker containers, and how to deploy a simple web server application. Introduction Containerization is a technology that has revolutionised the way applications are developed, deployed, and managed in the modern IT landscape. It provides a standardised and efficient way to package, distribute, and run software applications and their dependencies in isolated environments called containers. Containerization technology has gained immense popularity, with Docker being one of the most well-known containerization platforms. This introduction explores the fundamental concepts of containerization, its benefits, and how it differs

Experiment No. 10 Title: Create the GitHub Account to demonstrate CI/CD pipeline using Cloud Platform.

  Experiment No. 10 Title: Create the GitHub Account to demonstrate CI/CD pipeline using Cloud Platform. Objective: The objective of this experiment is to help you create a GitHub account and set up a basic CI/CD pipeline on GCP. You will learn how to connect your GitHub repository to GCP, configure CI/CD using Cloud Build, and automatically deploy web pages to an Apache web server when code is pushed to your repository. Introduction: Continuous Integration and Continuous Deployment (CI/CD) pipelines are essential for automating the deployment of web applications. In this experiment, we will guide you through creating a GitHub account and setting up a basic CI/CD pipeline using Google Cloud Platform (GCP) to copy web pages for an Apache HTTP web application. Continuous Integration and Continuous Deployment (CI/CD) is a crucial practice in modern software development. It involves automating the processes of code integration, testing, and deployment to ensure that software changes are co