The Git integration supports tagging a particular commit or object to refer to it in the future. Basically, by adding a tag you create a branch that never moves.
You can also create annotated tags and have annotations displayed to facilitate viewing and navigating through tagged commits.
To assign a tag to a commit
- On the main menu, choose . The Tag dialog box opens.
- From the Git Root drop-down list, select the required local repository.
The Current Branch read-only field shows the branch you are currently working with in the selected repository. The contents of the read-only field change as you change the selection in the Git Root drop-down list.
- In the Tag Name text box, type the name of the new tag.
- In the Commit text box, specify the commit or object which you want to tag:
- To tag the latest commit in the branch (HEAD), leave the text box empty.
- To tag a particular commit, specify its commit hash or use an expression, for example, of the following structure:
<branch>~<number of commits backwards between the latest commit (HEAD) and the required commit>.
Refer to the Git commit naming conventions for details.
- To check that the specified commit exists and is the one you actually need, click the Validate button.
The Paths affected in commit dialog box shows the files that were affected in the specified commit.
View the information and click OK.
If you specify a commit that does not exist, IntelliJ IDEA displays an error message.
To create an annotated tag
- Create a tag.
- In the Message text box, provide a description of the commit.