Git command - Label

Git commands associated with the tag are:

  1. Tag git $                                    # list all of the local labels
  2. Tag -a git $ <Tagname>             # create a note tag
  3. Tag git $ <Tagname>                 # create a lightweight tag
  4. Show git $ <Tagname>             # View tag information and corresponding information submitted
  5. Origin git the Push $ [Tagname]   # label transferred to a remote repository server    
  6. Git Tag -d $ <Tagname>            # Deletes the specified label from the local warehouse             

 

1. List the label

Use git tag all the local label lists:


 

You can also use a specific pattern to find the tag. For example, the number of the source code itself Git repository contains more than 500 labels. If you are interested in only the 1.8.5 series, you can run:

 

2. Create a label

Git two main types of tags: lightweight tag (Lightweight) and Notes tab (annotated).

  • A lightweight tag much like a branch that does not change - it's just a reference to a particular submission.
  • Note tag is a complete Git objects are stored in the database. They can be verified; which includes playing tag's name, email address, date and time; there is a tag information; and using GNU Privacy Guard (GPG) signature verification. Note label is usually recommended that you create, so you can have all this information; but if you just want a temporary tag or for some reason do not want to save that information, lightweight tags are also available.

 

2.1 Note label created

Create a note tag in Git is simple. The easiest way is when you run the tag specified command -a option:

-m option specifies the information will be stored in a tag. If you do not specify a label information notes, Git will run editor asks you to enter information.

 

By using the git show command you can see the corresponding tag information and submit information:

 The output shows the information label's play, playing tag date and time, notes information, then display specific information submitted.

 

2.2 to create a lightweight tag

Another way to submit tagging is to use a lightweight tag. The lightweight nature of the label is to be submitted checksum stored in a file - does not save any additional information. Create a lightweight tag, do not use -a , -s , or -m option, only you need to provide the label name:

 

 At this time, if you are running on the label git Show , you will not see the extra tag information. Command shows only submit information:

 

2.3 post-tagging

You can also play tag of the past submission. Assume commit history is this:

 

Now, suppose that when you forget to v1.2 tagging project, that is, "updated rakefile" submit. You can make up after the label. To play tag in that submission, you need to specify and verify submitted (or part of a checksum) at the end of the command:

 

3. Sharing tab

By default, git the Push command does not transfer tags to remote repository server. After creating the label you have to explicitly push tags to a shared server. This process is the same as remote branches - you can run git the Push Origin [Tagname] .

 

If you want to push a lot of disposable labels can also be used with --tags option git push command. This will not put labels on all remote servers are transported to the warehouse there.

$ git push origin --tags

Now, when someone else clones or pulls from the warehouse, they can get you those labels.

 

4. Remove the label

The label on the local repository you want to delete, you can use the command git Tag -d <Tagname> . For example, you can use the following command to delete a lightweight tag:

 

It should be noted that the above command does not remove the label from any remote repository, you must use git push <remote>: refs / tags / <tagname> to update your remote repository:

 

Guess you like

Origin www.cnblogs.com/shichangxing/p/11442313.html
Recommended