首页 >> 大全

git diff 简要_Git标记—简要指南

2023-11-30 大全 22 作者:考证青年

git diff 简要

Git an to tag (or mark) a point in your repo which helps you to the tag later and also the at any time in the .

Git提供了一个选项来标记(或标记)您的存储库中的特定点,这可以帮助您以后识别标记并在将来的任何时候查看更改。

You can see tags as a in your repo. They are like but you can’t add more to it once a tag is . .

您可以在存储库中看到标签作为检查点。 它们就像分支一样,但是一旦创建了标签,便无法对其添加更多更改。 简单。

Most use to mark a in the . So they can those later.

大多数人使用标记来标记项目中的特定版本。 因此他们可以稍后查看这些版本。

And it is also a very good to use . It helps to how the has over a of time.

使用标记也是一种很好的做法。 它可以帮助人们了解项目在一段时间内的发展情况。

创建标签 ( tag)

tags, I like to that there are two types of tags.

在创建标签之前,我想提到一下,标签有两种。

tags are just tags that are just a to a hash. these tags are used for .

轻量级标签只是简单的标签,只是指向特定提交哈希的指针。 通常,这些标签是出于临时原因使用的。

tags are used and have info like name, date, and . If you are for a , you use tags.

注释的标签是最常用的,并且具有附加信息,例如标签名称,日期和标签消息。 如果要标记永久指针,则应使用带注释的标记。

创建轻量级标签 ( tags)

git tag  Example: git tag v1.1-1w

In the above , v1.1–1w is the tag name.

在上面的命令中, v1.1–1w是标签名称。

创建带注释的标签 ( tags)

git tag -a  Example: git tag -a v1.2

-a is the used to an tag.

-a是用于创建带注释标签的选项。

You will be with a tag

系统将提示您标记消息

You can write some for the and save the file.

您可以为发布写一些相关的消息并保存文件。

The of the above is

上面命令的简写是

git tag -a v1.2 -m "Release V1.2"

The above will take a tag .

上面的命令将带有标签消息选项。

And also that Git will take the HEAD ( ) to the tag.

还要记住,Git将采用HEAD提交(最新提交)来创建标签。

将标签推入遥控器 ( the tags to the )

You have to push tags to the .

您必须将标签明确推入遥控器。

git push origin v1.2 // Will push the mentioned tag. git push origin --tags // Will push all the tags to the origin.

标记旧提交 ( old )

You can also a tag from the hash. As I said by , Git will take the HEAD to tag.

您还可以通过显式提及提交哈希值来创建标签。 正如我之前所说的,默认情况下,Git将把HEAD 标记。

To tag an

标记显式提交

git tag -a   Example: git tag -a v1.1 84b2bbd

列出所有标签 ( all tags)

The above will list all tags of the repo.

上面的命令将列出仓库的所有标签。

To the tags, you can use

要搜索标签,您可以使用

-l will take a and list the tags. The above will list all tags in the v1 . * acts as a .

-l将采用搜索模式并列出相关标签。 上面的命令将列出v1系列中的所有标签。 *用作通配符。

标签信息 (Tag info)

You can view the tag info using

您可以使用查看标签信息

In the above , we have shown the tag info. You can see the tag name, , date, tag , and the .

在上面的示例中,我们显示了标签信息。 您可以看到标签名称,标签,日期,标签消息以及相应的提交。

签出标签 ( out a tag)

One of the of is that we can that in the . You can check-out a tag to a .

标记的有用功能之一是我们将来可以查看该指针。 您可以签出类似于分支的标签。

git checkout 

But by -out, you will be gone to the “ HEAD” state. It means that you are not to any to the tag. Even if you any , it won’t be in the tag or even in any .

但是通过签出,您将进入“已分离头”状态。 这意味着您不应该对标签进行任何更改。 即使您提交了任何更改,它也不会在标记或任何分支中可用。

-out the tag helps you to go that and just the .

签出标签可以帮助您找到该指针,然后仅查看更改。

删除标签 ( a tag)

Tags are very . They won’t much space in the repo. But if you need to clean the tags, then you can older tags.

标签非常轻巧。 他们不会在仓库中占用太多空间。 但是,如果您需要清洁标签,则可以删除较旧的标签。

_指南标示_简述指南的内容结构

To the tag from

从远程删除标签

git push origin --delete 

重新标记标签 ( tags)

, you have a wrong tag. You have to add some or some from the tag.

有时,您创建了错误的标签。 您必须添加一些提交或从标记中删除一些提交。

As we can’t tags with names (tag name is ), the no- is to the tag and the new one with the same name.

由于我们无法创建名称相似的标签(标签名称是唯一的),因此,无需费力的解决方法是删除标签并创建具有相同名称的新标签。

is to force a tag.

另一个选择是强制创建标签。

git tag -a -f   Example: 
git tag -a -f v1.2 // Considering HEAD commit git tag -a -f v1.2 84b2bbd // Considering a particular commit

-f is the to force a tag. So the tag that was will be with the new hash.

-f是强制创建标签的选项。 因此,已经创建的标签将被新的提交哈希替换。

To force push the tag to

强制将创建的标签推到远程

git push origin -f --tags

This will force push the tags to the .

这将强制将标签推到遥控器。

to use this with . If you are force the tags, then your team who have the tags in their local will face when they push.

请记住要谨慎使用。 如果您强行推入标签,则在本地具有标签的团队成员在推入标签时会遇到冲突。

中的标签和发行 (Tags and in )

Tags will be in too. You can see all your tags, edit, and new ones.

标签也会在中列出。 您可以查看所有标签,进行编辑和创建新标签。

also has a . are tied to a tag. you push a tag, a is also . You can also your own in which will a tag too.

还具有一个称为的功能。 版本与标签绑定。 每当您按下标签时,也会创建发布。 您还可以在本身中创建自己的发行版,这也将创建相应的标签。

Most will a new when new of the is to prod.

当产品的新版本发布到产品中时,大多数人会创建一个新版本。

You can see the of Rails repo here

您可以在此处查看Rails回购的版本

is one of the of Git. It helps you to see how your has over time.

标记是Git的有用功能之一。 它可以帮助您了解项目随着时间的变化。

Thank you for , I hope you new :)

谢谢您的阅读,希望您学到了一些新的东西:)

如果您来得这么多,那么我认为您对Git很有兴趣。 您可以订阅我的时事通讯以获得Git的技巧,窍门和高级主题。 (If you have come this much, then I think you are much in Git. You can to my to get , tips, and of Git.)

翻译自:

git diff 简要

关于我们

最火推荐

小编推荐

联系我们


版权声明:本站内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 88@qq.com 举报,一经查实,本站将立刻删除。备案号:桂ICP备2021009421号
Powered By Z-BlogPHP.
复制成功
微信号:
我知道了