lance
lance

Reputation: 107

How do you give a git commit a name?

How do you give a git commit a name?

E.g., from this Angular JS tutorial (click Workspace Reset Instructions):

git checkout -f step-2

How did they name the commit step-2?

Upvotes: 8

Views: 7966

Answers (2)

VonC
VonC

Reputation: 1324063

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.

Upvotes: 6

M.M
M.M

Reputation: 141554

You can use a tag:

git tag step-2 *commit-id*

Upvotes: 8

Related Questions