Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Git 中使用标签
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

如何在 Git 中使用标签

在本教程中,您已经学会了如何在 Windows, MacCommand Line 中使用 Git,以及 使用分支 工作。现在我们将讨论标签。

如果您错过了我们对标签的介绍,您可以在这里重新温习该内容

首先,让我们设置一些东西。创建一个名为tutorial的新目录,并使用 git init 命令初始化一个 Git 存储库。

$ mkdir tutorial
$ cd tutorial
$ git init
Initialized empty Git repository in /Users/username/Desktop/tutorial/.git/

然后在tutorial目录中创建一个名为myfile.txt的新文件,内容如下,并将它提交。

Anyone can learn Git with this tutorial and Backlog
$ git add myfile.txt
$ git commit -m "first commit"
[main (root-commit) a73ae49] first commit
1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 myfile.txt

此时,历史记录看起来是这样的:

Current history

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life