Tag operation in Git

Tag operation allows to provide meaning names for specific versions in the repository. Suppose Tom and Jerry decide to tag them into their project code so that they can then access it easily.

Create tags

Join us in tagging the current HEAD using the git tag command. Tom provides a tag name with -a option and provides a tag information with the -m option.

 tom @ CentOS project] $ pwd 
/ home / tom / top_repo / project

[tom @ CentOS project] $ git tag -a 'Release_1_0' -m 'Tagged basic string operation code' HEAD

If you want to tag a specific commit, then you use the exact commit ID instead of the HEAD pointer. Tom uses the following command to push the tag into the removal area.

 [tom @ CentOS project] $ git push origin tag Release_1_0 

The above command will produce the following result:

 Counting objects: 1, done. 
Writing objects: 100% (1/1), 183 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)
To gituser@git.server.com: project.git
* [new tag]
Release_1_0 -> Release_1_0

Observe the tags

Tom creates tags. Now, Jerry can observe all available tags using the git tag command with the -I option.

 [jerry @ CentOS src] $ pwd 
/ home / jerry / jerry_repo / project / src

[jerry @ CentOS src] $ git pull
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (1/1), done.
From git.server.com:project
* [new tag]
Release_1_0 -> Release_1_0
Chủ đề branch hiện thời là up to date.

[jerry @ CentOS src] $ git -l tag
Release_1_0

Jerry uses the git show command followed by its tag name to get a more detailed look at the tag.

 [jerry @ CentOS src] $ git show Release_1_0 

The above command will produce the following result:

 tag Release_1_0 
Tagger: Tom Cat
Date: Wed Sep 11 13:45:54 2013 +0530

Tagged basic string operation code


commit 577647211ed44fe2ae479427a0668a4f12ed71a1
Author: Tom Cat
Date: Wed Sep 11 10:21:20 2013 +0530

Removed binary executable

diff --git a / src / string_operations b / src / string_operations
xóa chế độ tập tin 100755
index 654004b.0000000
Binary files a / src / string_operations and / dev / null differ

Delete tags

Tom uses the following command to delete the tags from the repository stored internally and remotely.

 [tom @ CentOS project] $ git tag 
Release_1_0

[tom @ CentOS project] $ git -d tag Release_1_0
Deleted tag 'Release_1_0' (was 0f81ff4)
# Remove thẻ từ remote repository.

[tom @ CentOS project] $ git push origin: Release_1_0
To gituser@git.server.com: project.git
- [deleted]
Release_1_0

According to Tutorialspoint

Previous article: Fix errors in Git

Next article: Patch operation in Git

4 ★ | 2 Vote

May be interested

  • Instructions on how to cross cells in ExcelInstructions on how to cross cells in Excel
    the operation of dividing 1 cell into 2 diagonal triangle cells with a line in excel is an extremely basic operation and is often performed in the process of creating tables in excel.
  • Guide to change the direction of the scrolling page of Touchpad Windows 10Guide to change the direction of the scrolling page of Touchpad Windows 10
    to be able to scroll a certain page or window on windows 10, in addition to using the mouse we will perform the operation of moving the finger from top to bottom at touchpad. however, we can also change this default operation with a fairly simple operation.
  • How to Fix 'Error 0x00000709: Operation Could Not Be Completed' on WindowsHow to Fix 'Error 0x00000709: Operation Could Not Be Completed' on Windows
    it's frustrating when something as simple as setting up a default printer on windows results in an error. luckily, resolving the operation could not be completed (error 0x00000709) error isn't too difficult.
  • Operator in programming COperator in programming C
    operator is a symbol that tells the compiler to perform a certain mathematical operation or logical operation. language c has a lot of operators and provides operator types.
  • What is air purifier? What is the structure and mechanism of operation?What is air purifier?  What is the structure and mechanism of operation?
    along learn more about the structure, operating principles, features of air purifiers to choose for your home, office work the most appropriate device!
  • The Hotmail service has returned to normal operationThe Hotmail service has returned to normal operation
    microsoft's hotmail service has returned to normal operation since january 3 after encountering several bugs at the end of the year.
  • Simple operations to speed up the MacbookSimple operations to speed up the Macbook
    in addition to the flashy and expensive design, the apple imacs, macbooks, mac mini, mac pro are always famous for their incredibly remarkable work speed from thorough and self-contained synchronization. however, it can become 'sluggish' after a period of use if not 'properly' cared for.
  • Patch operation in GitPatch operation in Git
    the patch is a text file, its content is similar to git diff, but in parallel with the code, it also has metadata about commits such as commit ids, dates, commit messages ... we can create a patch from commits and others can apply them to their repository.
  • Stash operation in GitStash operation in Git
    suppose you are implementing a new feature of your product. your code is in progress, suddenly a visitor. because of this, you have to go out for a few hours. you cannot commit this code and cannot throw it away at your changes. so you need some temporary space, where you can keep these local changes and then return to commit it.
  • SELF JOIN in SQLSELF JOIN in SQL
    each join operation must have two tables, but there are cases where you have to perform join on the same table, but you can call this join operation self join.