Git

How to Clone Tag from GitLab Projects?

In development project history, tags indicate the milestones, such as bug fixes, a release candidate, the latest program version, or patches. When users debug or introduce new functionalities, it is sometimes easier to clone those particular points as compared to cloning the whole project, or development branch.

This guide will demonstrate the process of cloning tags from GitLab projects.

How to Clone Tag from GitLab Projects?

To clone a tag from GitLab projects, follow the below stated steps:

  • Select the GitLab project and copy its HTTPS URL.
  • Open the Git utility and move toward the Git root directory.
  • Run the β€œgit clone -b <tag-name> <remote-url>” command.
  • For verifications, use the β€œgit tag” command.

Step 1: Open GitLab Project

Initially, sign in to your GitLab remote server, and select the desired project from which you want to clone the tag. Here, we have selected β€œDemo1” which contains the β€œv1.4” remote tag:

Step 2: Copy the Remote URL

Next, click on the β€œCode” button, and copy the HTTPS URL:

Step 3: Navigate to Git Directory

Then, execute the β€œcd” command along with the Git root directory and redirect to it:

cd "C:\Users\nazma\Git\Git"

Step 4: Clone Git Tag

After that, clone the GitLab remote tag using the below-given command:

git clone -b v1.4 https://gitlab.com/devteam5985925/Demo1.git

Here:

  • β€œ-b” option indicates the branch.
  • β€œv1.4” represents the tag name that we want to clone.
  • β€œhttps://….” is our remote project path.

According to the provided output, we have successfully cloned the remote tag:

Step 5: View the Tag List

Lastly, run the β€œgit tag” command to check whether the cloned remote tag exists in the local machine or not:

git tag

That’s all! We have compiled the easiest method of cloning tags from GitLab projects.

Conclusion

To clone a tag from GitLab projects, first, select the GitLab project which contains tags and copy its HTTPS URL to the clipboard. Then, launch the Git utility and redirect to the Git root directory. After that, execute the β€œgit clone -b <tag-name> <remote-url>” command. Lastly, verify it by running the β€œgit tag” command. This tutorial illustrated cloning tags from GitLab projects.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.