In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the git tag management example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.
When we release a version, we usually tag it first in the version library, so that we can only determine the version at the moment of tagging. Whenever you take the version of a tag in the future, you will take out the historical version of that tagged moment. Therefore, the tag is also a snapshot of the version library.
Although the Git tag is a snapshot of the version library, it is actually a pointer to a commit (much like a branch, right? But branches can be moved, tags cannot be moved), so tags are created and deleted instantly.
Git has commit, so why introduce tag?
"Please package and release the version of last Monday, the serial number is 6a5819e."
"A jumble of numbers is hard to find!"
If we find another way:
"Please package and release the version of last Monday, the version number is v1.2."
"OK, just follow tag v1.2 to find commit!"
So, tag is a meaningful name that is easy to remember, tied to some commit.
Create label
Tagging in Git is very simple. First, switch to the branch that needs to be tagged:
$git branch* dev master$ git checkout masterSwitched to branch 'master'
Then, by typing the command git tag, you can type a new label:
$git tag v1.0
You can view all tags with the command git tag:
$git tagv1.0
The default tag is typed on the most recently submitted commit. Sometimes, what if you forget to tag, for example, it is already Friday, but the label that should be typed on Monday is not typed?
The way to do this is to find the commit id submitted by history and type it:
$git log-- pretty=oneline-- abbrev-commit6a5819e merged bug fix 101cc17032 fix bug 1017825a50 merge with no-ff6224937 add merge59bc1cb conflict fixed400b400 & simple75a857c AND simplefec145a branch testd17efd8 remove test.txt...
For example, if you want to tag this submission of add merge, its corresponding commit id is 6224937. Type in the command:
$git tag v0.9 6224937
Then use the command git tag to view the label:
$git tagv0.9v1.0
Note that the labels are not listed in chronological order, but alphabetically. You can use git show to view tag information:
$git show v0.9commit 622493706ab447b6bb37e4e2a2f276a20fed2ab4Author: Michael Liao Date: Thu Aug 22 11:22:08 2013 + 0800 add merge...
As you can see, v0.9 is indeed typed on this submission by add merge.
You can also create a label with a description, specify the signature with-a, and specify the description text with-m:
$git tag-a v0.1-m "version 0.1 released" 3628164
With the command git show, you can see the description text:
$git show v0.1tag v0.1Tagger: Michael Liao Date: Mon Aug 26 07:28:11 2013 + 0800version 0.1releasedcommit 3628164fb26d48395383f8f31179f24e0882e1e0Author: Michael Liao Date: Tue Aug 20 15:11:49 2013 + 0800 append GPL
You can also sign a label with the private key via-s:
$git tag-s v0.2-m "signed version 0.2 released" fec145a
The signature is signed by PGP, so you must install gpg (GnuPG) first. If no gpg is found, or there is no gpg key pair, an error will be reported:
Gpg: signing failed: secret key not availableerror: gpg failed to sign the dataerror: unable to sign the tag
If you report an error, please refer to the GnuPG help documentation to configure Key.
You can see the PGP signature information with the command git show:
$git show v0.2tag v0.2Tagger: Michael Liao Date: Mon Aug 26 07:28:33 2013 + 0800signed version 0.2released-BEGIN PGP SIGNATURE-Version: GnuPG v1.4.12 (Darwin) iQEcBAABAgAGBQJSGpMhAAoJEPUxHyDAhBpT4QQIAKeHfR3bo...-END PGP SIGNATURE-commit fec145accd63cdc9ed95a2f557ea0658a2a6537fAuthor: Michael Liao Date: Thu Aug 22 10:37:30 2013 + 0800 branch test
Tags signed with PGP cannot be forged because PGP signatures can be verified. The method of verifying a signature is complicated, so I won't cover it here.
Operation label
If the label is mistyped, you can also delete:
$git tag-d v0.1Deleted tag 'v0.1' (was e078af9)
Because the tags created are only stored locally, they are not automatically pushed to the remote. Therefore, mistyped labels can be safely deleted locally.
If you want to push a tag to the remote, use the command git push origin:
$git push origin v1.0Total 0 (delta 0), reused 0 (delta 0) To git@github.com:michaelliao/learngit.git * [new tag] v1.0-> v1.0
Or, push all the local tags that have not been pushed to the remote at one time:
Git push origin-- tagsCounting objects: 1, done.Writing objects: 100% (1 new tag 1), 554 bytes, done.Total 1 (delta 0), reused 0 (delta 0) To git@github.com:michaelliao/learngit.git * [new tag] v0.2-> v0.2 * [new tag] v0.9-> v0.9
If the tag has been pushed to the remote, it is a bit more troublesome to delete the remote tag, first delete it locally:
$git tag-d v0.9Deleted tag 'v0.9' (was 6224937)
Then, delete it from the remote. The delete command is also push, but the format is as follows:
$git push origin: refs/tags/v0.9To git@github.com:michaelliao/learngit.git-[deleted] v0.9
To see if the tag has actually been removed from the remote library, log in to GitHub to check it.
Thank you for reading this article carefully. I hope the article "sample Analysis of git tag Management" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Server.c#include # include int main (int
© 2024 shulou.com SLNews company. All rights reserved.