How to use tag in git

Source: Internet
Author: User
Tags tag name how to use git

How to use Git to get the code for the specified tag
Tag is a reference to the history of a submit ID, if understood this sentence to understand the
use of git checkout tag to switch to the specified tag, for example: Git checkout v0.1.0

switch to the tag history will be in the split head pointer State, This is the change is very dangerous, in the switch back to the main line if not merged, before the modification of the basic will be lost, if you need to modify can try git checkout-b branch tag to create a branch based on the specified tag, for example: Git checkout-b tset v0.1.0  will be developed at this time on the branch and then switch to mainline merging

http://blog.csdn.net/rainnings/article/details/9821027

The tag in Git points to a commit ID, which is typically used to mark the development branch, such as marking a version number.

play tag git tag-a v1.01-m "relase version 1.01"

Note: git tag is the label command,-A is the tag, followed by the new tag number,-M and the following string is a comment on the label. Submit tags to remote warehouse
git push origin-tags
Note: Just as GIT push Origin master submits local modifications to the remote repository,-tags can submit all local dozen labels to the remote repository.
Delete Label
Git tag-d v1.01
Note:-D means delete, followed by tag name to be deleted
Remove Remote label
git push origin:refs/tags/v1.01
Annotations: Just like git push origin:branch_1 can delete the branch branch_1 of a remote warehouse, the colon is empty before the deletion of the remote warehouse tag.
View Labels
git tag
Or

Git tag-l

http://blog.csdn.net/hustpzb/article/details/8056518

To sync tags to a remote server, we can do this:

By default, git push does not transfer the tag tag to the remote server, only by explicit command to share the tag to the remote repository.
1.push single tag, the command format is: Git push origin [tagname]
For example:
Git push Origin v1.0 #将本地v1.0 's tag push to the remote server
2.push all tags, the command format is: git push [Origin]--tags
For example:
git push--tags
Or
Git push Origin--tags

If the above command is checked through, if it does not work, please confirm your account's permission to push tag on git console. This is important, for this reason, I have been crazy for some time.


Git clones the entire warehouse first, then git checkout tag_name can get tag code.

But this time git may prompt you to be currently in a "detached head" state, because the tag is equivalent to a snapshot, is not able to change its code, if you want to make changes based on the tag code, you need a branch:?

1 git checkout-b branch_name tag_name

This creates a branch from tag, and then it's the same as the normal git operation.

Hi, thank you very much first.

What if I need to manage multiple modules through repo?

I know that if you use repo to fetch branch code, you will use. repo/manifests/default.xml, repo init-u URL (warehouse address)-B branch_name, and then through Repo sync will get the corresponding branch of the corresponding code (seemingly default.xml "revision" is to specify the corresponding branch). So, if I play tag on some branch, how do I get the code for tag?

is first repo init, repo sync get branch code, and then through repo forall-v-c git checkout tag_name get tag corresponding code.

Alternatively, you can assign the "revision" in the. Repo/manifests/default.xml as tag as you would get the branch code, and get it directly through repo init and repo sync.  I have tried to directly "revision" into tag_name, seemingly is not the ... I wonder if you have any good methods or good suggestions.

In fact, to get a different branch tag, just need to play in the corresponding branch tag on the line. Such a tag would only correspond to a different branch. For example, you hit the master tag for V1, in a branch on a dozen tag for v2, then you take out v2 code, nature is the corresponding branch branch.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.