简体   繁体   中英

How do you give a git commit a name?

How do you give a git commit a name?

Eg, from this Angular JS tutorial (click Workspace Reset Instructions ):

git checkout -f step-2

How did they name the commit step-2 ?

您可以使用标签:

git tag step-2 *commit-id*

You wouldn't use git tag alone, as it produces a lightweight tag (a tag reference for the SHA-1 object name of the commit object).

In the case of the angular/angular-phonecat , they use:

git tag -m "step-2 angular template with repeater" step2

Adding a comment is enough to make it an " annotated " tags; they contain a creation date, the tagger name and e-mail, a tagging message, and an optional GnuPG signature.

  • Annotated tags are meant for release
  • while lightweight tags are meant for private or temporary object labels.

As you can see, step2 is a release (annotated) tag .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM