How to Create Git Tag?
Here are the steps to create a tag in Git:
- Make sure you are on the correct branch:
Before creating a tag, ensure you are on the branch where you want to create the tag. You can check the current branch with:git branch
And switch branches if needed with:
```bash
git checkout branch-name
```
2. **Decide the name of the tag:**
Choose a descriptive name for your tag to make it easier to understand in the future.
3. **Create the tag:**
Once on the correct branch and with your chosen tag name, run:
```bash
git tag <tag-name>
```
For example, to create a tag named `v1.0`:
```bash
git tag v1.0
```
This creates the tag at the current `HEAD`.
4. **Verify the tag creation:**
To see all tags in the repository:
```bash
git tag
```
This lists all tags alphabetically.
5. **Push tags to the remote repository:**
To push all your tags to the remote repository, use:
```bash
git push --tags
```
That's it! You have now created and pushed a tag in Git.