Skip to main content

Hotfix based on Tag

1. Ensure your repository is up to date
git fetch --all
git fetch --tags

2. List all available tags

git tag -l

3. Create a new branch based on the desired tag

git checkout -b hotfix/ISSUE-123 tags/v1.2.3

Optional: Verify you're on the correct commit

git log --oneline -n 1

4. Push the new branch to remote repository

git push -u origin hotfix/ISSUE-123

5. Commit your changes

git add .
git commit -m "fix: description of the fix"

6. Create a new tag for the hotfix -> Increment the patch version (e.g., v1.2.3 → v1.2.4)

git tag -a v1.2.4 -m "Hotfix for issue XYZ"

7. Push the changes and the new tag

git push origin hotfix/ISSUE-123
git push origin v1.2.4

8. Merge into master (after code review)

git checkout master
git merge hotfix/ISSUE-123
git push origin master

Optional: Delete branch after successful integration

git branch -d hotfix/ISSUE-123
git push origin --delete hotfix/ISSUE-123