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

Maven Create and Build Artifacts

In Maven, you can create and build artifacts using the package phase of the build lifecycle. The package phase is responsible for taking the compiled code and other project resources and packaging them into a distributable format, such as a JAR (Java Archive), WAR (Web Application Archive), or other custom formats. Here are the steps to create and build artifacts using Maven: Configure the Build Output: In your project's pom.xml file, you need to configure the output of the build. This includes specifying the type of artifact you want to create (e.g., JAR, WAR) and any additional resources to include. You do this in the <build> section of your pom.xml: <build>     <finalName>my-artifact</finalName> <!-- Name of the artifact without the extension -->     <plugins>         <!-- Plugin configurations for creating the artifact -->         <!-- For example, maven-jar-plugin or maven-war-plugin -->     </plugins> </build> Depend

Example of Maven project that interacts with a MySQL database and includes testing

Example Maven project that interacts with a MySQL database and includes testing To install Java, MySQL, Maven, and write a Java program to fetch table data, execute, and create a JAR file using Maven on Ubuntu, you can follow these steps: Step 1: Install Java You can install Java using the following commands: sudo apt update sudo apt install default-jre sudo apt install default-jdk Verify the installation by running: java -version Step 2: Install MySQL You can install MySQL using the following commands: sudo apt update sudo apt install mysql-server During the installation, you'll be prompted to set a root password for MySQL or you can set password at latter stage using following steps.  sudo mysql ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; exit Step 3: Install Maven You can install Maven using the following commands: sudo apt update sudo apt install maven Verify the installation by running: mvn -version Step 4: Create

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