Git Branches, Releases, Hotfixes, Tags మరియు Semantic Versioning — Real-Time Project Examples
Software development లో code రాయడం ఎంత ముఖ్యమో, ఆ code ని సరైన పద్ధతిలో maintain చేయడం కూడా అంతే ముఖ్యం.
ముఖ్యంగా ఒక website production లో live అయిన తర్వాత కొత్త features develop చేయడం, bugs fix చేయడం, releases manage చేయడం చాలా జాగ్రత్తగా చేయాలి.
ఈ tutorial లో Git Branching Strategy ని beginner level నుంచి professional workflow వరకు తెలుసుకుందాం.
Real-world example: VizagUpdates.com — React.js frontend, Laravel backend, MySQL database.
1. Git అంటే ఏమిటి?
Git అనేది Distributed Version Control System.
మన project లో ఎప్పుడు ఏ changes చేశాం, ఎవరు చేశారు, ఏ version production లో ఉంది, అవసరమైతే పాత version కి ఎలా వెళ్లాలి వంటి విషయాలను Git ద్వారా manage చేయవచ్చు.
ఉదాహరణకు:
November 21 — Website launch
November 23 — UI improvements
November 25 — SEO improvements
December 5 — Business Directory release
ఈ changes అన్నింటినీ Git history ద్వారా track చేయవచ్చు.
Git vs GitHub vs Bitbucket
| Tool | Purpose |
|---|---|
| Git | Source code version control |
| GitHub | Git repositories hosting and collaboration |
| Bitbucket | Git repositories hosting and collaboration |
| GitLab | Git hosting, collaboration, CI/CD |
Git అనేది underlying technology. GitHub, Bitbucket, GitLab అనేవి Git repositories ని host చేసే platforms.
2. Git Branch అంటే ఏమిటి?
Branch అంటే ఒక development line.
మన project లో production code కి disturbance లేకుండా కొత్త functionality develop చేయడానికి separate branch ఉపయోగిస్తాం.
ఉదాహరణ:
ప్రస్తుతం VizagUpdates.com లో Articles, Events, Properties modules live లో ఉన్నాయి.
ఇప్పుడు Business Directory develop చేయాలి.
నేరుగా production branch లో code మార్చకుండా, feature/business-directory అనే branch create చేస్తాం.
దీంతో Business Directory code ని independently develop చేసి, test చేసి, తర్వాత production లోకి తీసుకురావచ్చు.
3. Git లో ఉపయోగించే ముఖ్యమైన Branch Types
3.1 main — Production Branch
main అనేది production-ready code ని maintain చేసే branch.
ఉదాహరణ:
main → vizagupdates.com
ఈ branch లోకి thoroughly tested changes మాత్రమే merge చేయాలి.
Production deployment సాధారణంగా ఈ branch నుంచి జరుగుతుంది.
3.2 develop — Integration Branch
Developers కొత్త features పూర్తి చేసిన తర్వాత వాటిని integrate చేసి test చేసే branch.
ఉదాహరణ:
develop లో:
Business Directory improvements
SEO improvements
UI changes
ఉండవచ్చు.
కానీ ఇవన్నీ production-ready అయ్యే వరకు main లోకి merge చేయకూడదు.
3.3 feature/* — Feature Branch
కొత్త functionality లేదా సాధారణ improvements కోసం.
Examples:
feature/business-directoryfeature/seo-improvementsfeature/article-searchfeature/ui-improvements
సాధారణంగా develop నుంచి create చేస్తాం.
3.4 bugfix/* — Normal Bug Fix Branch
Development లేదా testing సమయంలో కనిపించిన non-urgent bugs కోసం.
Examples:
bugfix/form-validationbugfix/image-alignmentbugfix/search-filter
సాధారణంగా develop నుంచి create చేసి, తిరిగి develop లో merge చేస్తాం.
3.5 hotfix/* — Urgent Production Fix
Production లో critical issue వచ్చినప్పుడు ఉపయోగిస్తాం.
Examples:
Login పూర్తిగా పనిచేయకపోవడం
Payment processing failure
Critical security vulnerability
Website crash
సాధారణంగా main నుంచి create చేసి, testing తర్వాత main లో merge చేస్తాం.
అదే fix ని develop లో కూడా integrate చేయాలి.
3.6 release/* — Release Preparation Branch
కొత్త version production లోకి వెళ్లే ముందు final testing, stabilization కోసం.
Examples:
release/1.1.0release/1.2.0release/2.0.0
సాధారణంగా develop నుంచి create చేస్తాం.
ఈ branch లో కొత్త features add చేయకుండా, release-specific fixes మాత్రమే చేయడం మంచిది.
Release complete అయిన తర్వాత main లో merge చేసి, అవసరమైన fixes ని develop లోకి తిరిగి తీసుకురావాలి.
3.7 chore/* — Maintenance Branch
Application functionality మార్చకుండా maintenance పనులు చేయడానికి.
Examples:
chore/update-dependencieschore/cleanup-configchore/improve-build-script
3.8 docs/* — Documentation Branch
Documentation updates కోసం.
Examples:
docs/api-documentationdocs/deployment-guide
3.9 refactor/* — Code Refactoring Branch
External functionality మార్చకుండా internal code structure మెరుగుపరచడానికి.
Example:
refactor/business-service
ఇవి naming conventions మాత్రమే. Git స్వయంగా feature, hotfix, release వంటి branch types కి ప్రత్యేక behavior ఇవ్వదు. Team workflow ద్వారా వాటి purpose నిర్ణయిస్తాం.
4. Complete Git Branching Diagram
flowchart TD
M["main — Production"]
D["develop — Integration"]
F["feature/business-directory"]
B["bugfix/form-validation"]
C["chore/dependency-update"]
R["release/1.1.0"]
H["hotfix/payment-error"]
T["Git tag: v1.1.0"]
M -->|Create integration branch| D
D -->|Create feature| F
D -->|Create bugfix| B
D -->|Create maintenance branch| C
F -->|Merge after review| D
B -->|Merge after review| D
C -->|Merge after review| D
D -->|Prepare release| R
R -->|Merge after testing| M
R -->|Sync release fixes| D
M -->|Create urgent fix| H
H -->|Merge| M
H -->|Sync fix| D
M -->|Tag release commit| Tఈ diagram లో main production కి, develop integration కి ఉపయోగిస్తున్నాం.
Feature branches లో development పూర్తయిన తర్వాత Pull Request ద్వారా develop లోకి merge చేస్తాం.
Release branch optional. చిన్న team అయితే develop నుంచి నేరుగా main కి tested changes merge చేయవచ్చు.
5. Git Tag మరియు Git Branch మధ్య తేడా
ఇది చాలా ముఖ్యమైన concept.
Branch అనేది కొత్త commits వచ్చినప్పుడు ముందుకు కదిలే reference.
Tag అనేది ఒక నిర్దిష్ట commit ని గుర్తించడానికి ఉపయోగించే reference.
ఉదాహరణ:
v1.0.0 — First website launch
v1.0.1 — Small bug fix
v1.1.0 — New feature release
v2.0.0 — Major breaking changes
సాధారణంగా release tags ని మార్చకుండా immutable references లాగా maintain చేయాలి.
Example
git switch main
git pull --ff-only origin main
git tag -a v1.0.0 -m "Initial production release"
git push origin v1.0.0Important: Tag create చేయడానికి ముందు main లోని commit నిజంగా production లో deploy చేసిన commit అని verify చేయాలి.
Tag ని push చేయడం వల్ల website deploy అవదు. Deployment వేరే process.
6. Semantic Versioning (SemVer)
Version numbers సాధారణంగా ఈ format లో ఉంటాయి:
MAJOR.MINOR.PATCH
ఉదాహరణ:
1.4.2
ఇందులో:
1— Major4— Minor2— Patch
PATCH — 1.0.0 → 1.0.1
Backward-compatible bug fixes కోసం.
Example: Article image display bug fix.
MINOR — 1.0.1 → 1.1.0
Backward-compatible functionality add చేసినప్పుడు.
Example: Business Directory module.
MAJOR — 1.1.0 → 2.0.0
Breaking changes వచ్చినప్పుడు.
Example: Existing API consumers కి incompatible changes చేయడం.
SemVer అనేది ముఖ్యంగా public API compatibility గురించి formal convention. Websites లో teams తమ release numbering policy గా కూడా ఉపయోగించవచ్చు.
ప్రతి చిన్న UI change కి తప్పనిసరిగా కొత్త major లేదా minor version అవసరం లేదు.
7. First-Time Git Setup — VizagUpdates Example
Website ఇప్పటికే live లో ఉందని అనుకుందాం.
Step 1: Check current branch
git branch
git statusWorking tree clean గా ఉందో verify చేయాలి.
Step 2: Update main
git switch main
git pull --ff-only origin mainStep 3: Tag production version
git tag -a v1.0.0 -m "Initial launch"
git push origin v1.0.0Step 4: Create develop branch
git switch -c develop
git push -u origin developఇప్పుడు మనకు:
maindevelopv1.0.0tag
ఉంటాయి.
8. New Feature Development Workflow
Business Directory develop చేయాలని అనుకుందాం.
Step 1: Start from develop
git switch develop
git pull --ff-only origin developStep 2: Create feature branch
git switch -c feature/business-directoryStep 3: Develop and commit
git add .
git commit -m "feat: add business registration"Step 4: Push branch
git push -u origin feature/business-directoryStep 5: Create Pull Request
Bitbucket లో:
Source: feature/business-directory
Destination: develop
Code review, automated tests పూర్తయిన తర్వాత merge చేయాలి.
9. Small Regular Changes ఎలా Handle చేయాలి?
ఉదాహరణకు homepage button spacing మార్చాలి.
ఇది urgent production hotfix కాదు.
git switch develop
git pull --ff-only origin develop
git switch -c feature/homepage-spacingChanges complete అయిన తర్వాత:
git add .
git commit -m "style: improve homepage button spacing"
git push -u origin feature/homepage-spacingతర్వాత develop లోకి Pull Request create చేయాలి.
Special case: develop లో unfinished features ఉంటే, చిన్న change కోసం మొత్తం develop ని production లోకి merge చేయకూడదు.
అలాంటి సందర్భంలో main నుంచి చిన్న isolated branch create చేసి, tested changes మాత్రమే main లో merge చేయవచ్చు.
ఇది urgent hotfix కాకపోయినా సరే.
10. Production Hotfix Workflow
ఉదాహరణ: Live website లో login పనిచేయడం లేదు.
git switch main
git pull --ff-only origin main
git switch -c hotfix/login-failureBug fix చేసిన తర్వాత:
git add .
git commit -m "fix: resolve production login failure"
git push -u origin hotfix/login-failureతర్వాత:
hotfix/login-failure→mainPull RequestReview and test
Merge into
mainDeploy production
Create
v1.0.1tagFix ని
developలోకి కూడా merge చేయాలి
దీంతో future release లో అదే bug మళ్లీ వచ్చే అవకాశం తగ్గుతుంది.
11. Release Branch Workflow
Business Directory feature, SEO improvements, UI improvements అన్నీ develop లో complete అయ్యాయని అనుకుందాం.
ఇప్పుడు v1.1.0 release prepare చేయాలి.
Step 1: Create release branch
git switch develop
git pull --ff-only origin develop
git switch -c release/1.1.0
git push -u origin release/1.1.0Step 2: Final testing
Release branch లో:
Regression tests
UI testing
API testing
Payment testing
Database migration checks
SEO checks
చేయాలి.
Step 3: Merge into main
Bitbucket Pull Request:
release/1.1.0 → main
Testing complete అయిన తర్వాత merge చేసి production deploy చేయాలి.
Step 4: Create tag
Production లో deploy అయిన exact commit కి:
git switch main
git pull --ff-only origin main
git tag -a v1.1.0 -m "Business Directory release"
git push origin v1.1.0Step 5: Sync release fixes
Release preparation లో చేసిన fixes ని develop లోకి కూడా merge చేయాలి.
Release complete అయిన తర్వాత temporary release branch delete చేయవచ్చు. Tag మాత్రం preserve చేయాలి.
12. Complete Version History Example
| Version | Changes | Branch |
|---|---|---|
v1.0.0 | First website launch | main |
v1.0.1 | Article image fix | hotfix → main |
v1.0.2 | Small stability improvements | main |
v1.1.0 | Business Directory | release → main |
v1.2.0 | Featured subscriptions | release → main |
v2.0.0 | Breaking API changes | main |
ఇది illustrative version history మాత్రమే.
13. Real Git History Diagram
gitGraph
commit id: "Initial launch"
branch develop
checkout main
commit id: "v1.0.0"
checkout develop
branch feature-directory
checkout feature-directory
commit id: "Business models"
commit id: "Directory UI"
checkout develop
merge feature-directory
branch release-1-1
checkout release-1-1
commit id: "Release QA fix"
checkout main
merge release-1-1
commit id: "v1.1.0"
checkout develop
merge release-1-1ఈ diagram లో ప్రతి commit ఒక code snapshot.
feature-directory branch లో చేసిన changes, testing తర్వాత develop లోకి వస్తాయి. Release complete అయిన తర్వాత main లోకి వస్తాయి.
14. Git Commit Message Conventions
Clean Git history కోసం meaningful commit messages రాయాలి.
| Prefix | Example |
|---|---|
feat: | feat: add business registration |
fix: | fix: resolve image upload error |
style: | style: improve mobile card spacing |
refactor: | refactor: simplify business service |
docs: | docs: update API guide |
test: | test: add subscription tests |
chore: | chore: update dependencies |
perf: | perf: optimize business search |
ఇవి Conventional Commits naming guidelines.
చాలా teams automated changelogs మరియు release tooling కోసం కూడా వీటిని ఉపయోగిస్తాయి.
15. Multiple Repositories ఎలా Maintain చేయాలి?
VizagUpdates లో మూడు separate repositories ఉన్నాయని అనుకుందాం:
React frontend
Laravel API
Admin panel
ప్రతి repository కి independent Git branches, commits, tags ఉంటాయి.
Example:
| Repository | Version |
|---|---|
| React frontend | v1.1.0 |
| Laravel API | v1.2.0 |
| Admin panel | v1.0.3 |
అన్ని repositories కి ఒకే version number ఉండాల్సిన అవసరం లేదు.
కానీ ఏ frontend version కి ఏ API version compatible అనేది release notes లో maintain చేయడం మంచిది.
16. Git మరియు Database Migrations
Git source code ని manage చేస్తుంది.
కానీ production MySQL database ని automatically backup చేయదు.
Laravel project లో migration create చేసినప్పుడు:
php artisan make:migration create_businesses_tableMigration file Git లో track అవుతుంది.
కానీ production database కి migration apply చేయడం separate deployment operation.
Production deployment కి ముందు:
Database backup
Migration review
Backward compatibility check
Rollback or recovery plan
File upload backup
తప్పనిసరిగా పరిశీలించాలి.
Important: Code ని previous tag కి rollback చేసినంత మాత్రాన database schema automatically rollback కాదు.
Production లో destructive database rollback commands ని blindly execute చేయకూడదు.
17. Common Git Commands Cheat Sheet
| Command | Purpose |
|---|---|
git status | Current changes |
git branch | Local branches |
git branch -a | Local and remote branches |
git switch main | Switch branch |
git switch -c feature/test | Create new branch |
git pull --ff-only origin main | Update without creating merge commit |
git add . | Stage changes |
git commit -m "message" | Commit changes |
git push -u origin branch-name | Push new branch |
git log --oneline --graph --all | View commit history |
git tag | List tags |
git fetch --prune | Update remote refs |
git branch -d branch-name | Delete merged local branch |
Before deleting branches, verify that their work has been merged or is no longer needed.
18. Git Best Practices
Never directly experiment on
main.Keep
mainproduction-ready.Create small, focused branches.
Use Pull Requests for review.
Run automated tests before merging.
Protect
mainagainst accidental direct pushes.Avoid committing
.env, passwords, API secrets, and credentials.Use meaningful commit messages.
Tag important production releases.
Maintain database backups independently.
Do not merge unfinished features into production.
Keep release notes.
Synchronize production fixes back into ongoing development.
Delete unnecessary merged branches.
Ensure deployment scripts use the intended branch or release tag.
19. Which Branching Strategy Should You Choose?
There are multiple established workflows.
Git Flow
Uses:
main
develop
feature
release
hotfix
Suitable for projects requiring planned releases and separate integration testing.
GitHub Flow
Uses:
main
short-lived feature branches
Developers create a branch, open a Pull Request, test, and merge into main.
Suitable for teams deploying frequently.
Trunk-Based Development
Developers integrate small changes frequently into a shared mainline.
Often uses feature flags and strong automated testing.
Suitable for teams with mature CI/CD practices.
Recommended for VizagUpdates
Since VizagUpdates is an early-stage project with a small development team, start with a lightweight workflow:
mainfor productiondevelopfor integration, if neededfeature/*for new workbugfix/*for normal fixeshotfix/*for urgent production fixesrelease/*only when stabilization is neededGit tags for production versions
Avoid creating unnecessary long-lived branches.
20. Final Summary
Git branching helps developers work safely without disturbing production.
For a live website:
Feature development → Testing → Code review → Production release → Version tag
The key principles are:
Branches organize development.
Commits record changes.
Pull Requests support review.
Tags identify releases.
Semantic versions communicate changes.
Deployment publishes tested code.
Database backups protect production data.
A clean Git workflow improves maintainability, teamwork, release reliability, and recovery from mistakes.
The goal is not to create more branches. The goal is to release reliable software safely and consistently.
Comments
Post a Comment
Thank you :)