Followers

git Tags -Example

  Tags are used for defining the version or release of your code. Prerequisites :- Local git repo should be created and have some files in i...

 Tags are used for defining the version or release of your code.


Prerequisites:- Local git repo should be created and have some files in it.

Branch:- working on the main branch


Step1:- Switch to the main branch

             git checkout main

Step2:- Consider the code which is in the main branch is the first to release code, so let's tag it with version v1.0 ( need to define the tag)

             git tag   # show all the tags

             git tag v1.0

             git tag # it will show v1.0

Step3:- Create some db files(emp.db, company.db) and commit it and these files will be part of the second release, so we need to define one more tag for this release.

           touch emp.db company.db

           git add -A

           git commit -m "db files has been added"

           git tag V2.0

           git tag # show all the tags

Step4:- Create some dependencies files( junit.dep,sel.dep) into your project and make the part minor release of the second version.

           touch junit.dep sel.dep

           git add -A

           git commit -m "dependencies files has been added"

           git tag V2.1

           git tag

Step5:- Display all the files which are released in V1.0 ( it should not show db and dep files)

            git checkout V1.0

            ls

Step6: Display all the files which are released in V2.0 ( it should show db files along with V1.0 files but should show the dep files)

           git checkout V2.0

           ls

Step7: Display all the files which are released in V2.1 ( it should show all the files)

           git checkout V2.1

           ls

Step 8: Push a V1.0 tag to remote repo (Gitlab/Github)

          git push origin V1.0

Step 9: Push all the tags to the remote repo

          git push --tags

Step10:- Check remote Repo (Gitlab/Github) and you will find the tag files in the tags section and if you want you can download those releases or you can edit the release notes and if these releases are not required on remote repo then you can delete it.

Step11:- Let's delete the tags in local repo

             git tag -d V2.1   # To delete V2.1 tag.

             git tag -d `git tag | grep -E '.'` # to delete all the tags


             git tag -d `git tag | grep -E '.'`




COMMENTS

Name

Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,Jira,1,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
ltr
item
DevOpsWorld: git Tags -Example
git Tags -Example
DevOpsWorld
https://www.devopsworld.co.in/2022/02/git-tags.html
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/2022/02/git-tags.html
true
5997357714110665304
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content