Skip to main content

Git Branching Strategy & Version Management — తెలుగులో పూర్తి గైడ్


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

ToolPurpose
GitSource code version control
GitHubGit repositories hosting and collaboration
BitbucketGit repositories hosting and collaboration
GitLabGit 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-directory

  • feature/seo-improvements

  • feature/article-search

  • feature/ui-improvements

సాధారణంగా develop నుంచి create చేస్తాం.

3.4 bugfix/* — Normal Bug Fix Branch

Development లేదా testing సమయంలో కనిపించిన non-urgent bugs కోసం.

Examples:

  • bugfix/form-validation

  • bugfix/image-alignment

  • bugfix/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.0

  • release/1.2.0

  • release/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-dependencies

  • chore/cleanup-config

  • chore/improve-build-script

3.8 docs/* — Documentation Branch

Documentation updates కోసం.

Examples:

  • docs/api-documentation

  • docs/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.0

Important: 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 — Major

  • 4 — Minor

  • 2 — 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 status

Working tree clean గా ఉందో verify చేయాలి.

Step 2: Update main

git switch main
git pull --ff-only origin main

Step 3: Tag production version

git tag -a v1.0.0 -m "Initial launch"
git push origin v1.0.0

Step 4: Create develop branch

git switch -c develop
git push -u origin develop

ఇప్పుడు మనకు:

  • main

  • develop

  • v1.0.0 tag

ఉంటాయి.


8. New Feature Development Workflow

Business Directory develop చేయాలని అనుకుందాం.

Step 1: Start from develop

git switch develop
git pull --ff-only origin develop

Step 2: Create feature branch

git switch -c feature/business-directory

Step 3: Develop and commit

git add .
git commit -m "feat: add business registration"

Step 4: Push branch

git push -u origin feature/business-directory

Step 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-spacing

Changes 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-failure

Bug fix చేసిన తర్వాత:

git add .
git commit -m "fix: resolve production login failure"
git push -u origin hotfix/login-failure

తర్వాత:

  1. hotfix/login-failure → main Pull Request

  2. Review and test

  3. Merge into main

  4. Deploy production

  5. Create v1.0.1 tag

  6. Fix ని 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.0

Step 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.0

Step 5: Sync release fixes

Release preparation లో చేసిన fixes ని develop లోకి కూడా merge చేయాలి.

Release complete అయిన తర్వాత temporary release branch delete చేయవచ్చు. Tag మాత్రం preserve చేయాలి.


12. Complete Version History Example

VersionChangesBranch
v1.0.0First website launchmain
v1.0.1Article image fixhotfix → main
v1.0.2Small stability improvementsmain
v1.1.0Business Directoryrelease → main
v1.2.0Featured subscriptionsrelease → main
v2.0.0Breaking API changesmain

ఇది 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 రాయాలి.

PrefixExample
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 ఉన్నాయని అనుకుందాం:

  1. React frontend

  2. Laravel API

  3. Admin panel

ప్రతి repository కి independent Git branches, commits, tags ఉంటాయి.

Example:

RepositoryVersion
React frontendv1.1.0
Laravel APIv1.2.0
Admin panelv1.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_table

Migration 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

CommandPurpose
git statusCurrent changes
git branchLocal branches
git branch -aLocal and remote branches
git switch mainSwitch branch
git switch -c feature/testCreate new branch
git pull --ff-only origin mainUpdate without creating merge commit
git add .Stage changes
git commit -m "message"Commit changes
git push -u origin branch-namePush new branch
git log --oneline --graph --allView commit history
git tagList tags
git fetch --pruneUpdate remote refs
git branch -d branch-nameDelete merged local branch

Before deleting branches, verify that their work has been merged or is no longer needed.


18. Git Best Practices

  1. Never directly experiment on main.

  2. Keep main production-ready.

  3. Create small, focused branches.

  4. Use Pull Requests for review.

  5. Run automated tests before merging.

  6. Protect main against accidental direct pushes.

  7. Avoid committing .env, passwords, API secrets, and credentials.

  8. Use meaningful commit messages.

  9. Tag important production releases.

  10. Maintain database backups independently.

  11. Do not merge unfinished features into production.

  12. Keep release notes.

  13. Synchronize production fixes back into ongoing development.

  14. Delete unnecessary merged branches.

  15. 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:

  • main for production

  • develop for integration, if needed

  • feature/* for new work

  • bugfix/* for normal fixes

  • hotfix/* for urgent production fixes

  • release/* only when stabilization is needed

  • Git 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

Popular posts from this blog

Data Types in Python

Data Types  In C# or Java, You need to declare a variable specify them integer, string, and decimal. But in Python no need to specify. We can declare variables like Example: C# or Java int age = 28; string Name = "Siddhu"; Example: Python age = 28 Name = "Siddhu" So, you don't need to declare variable types in python. This is an advantage in Python, But still have few Disadvantages too. Example: In my Python function def add_numbers(x,y): print(x+y) add_numbers(20,50) //Output: 70 add_numbers(20,"Something") //Error:"Traceback (most recent call last): File "C:/Users/siddhartha.e/PycharmProjects/siddhu-py/my1stpycode.py", line 8, in add_numbers(50,"Something") File "C:/Users/siddhartha.e/PycharmProjects/siddhu-py/my1stpycode.py", line 4, in add_numbers print(a + b) TypeError: unsupported operand type(s) for +: 'int' and 'str'" ...

Laravel all artisan commands and uses

Laravel all artisan commands and uses  Laravel commands Have you all know, Laravel run on mostly PHP artisan commands. here I'm going to provide a quick image that show all artisan commands on Laravel.  If do you want to check all Laravel commands, Just run the command on your CMD php artisan You will get all the commands 

Database and Migrations

Database and Migrations You can config Database in the .env file. By default, Laravel has MySQL configuration. For example, I configured my details DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=Laravel_tutorials DB_USERNAME=root DB_PASSWORD= So how it connects the database, In your root folder config/database.php file will read the .env file configuration. Migrations: Migrations are most likely a version control for your database. Advantages You can easily allow your team to modify database schema and share to everyone in the application No headache to add a new column in the database manually. This migration will help all teammates into one path. Now check with artisan command php artisan migrate php artisan migrate This command will create basic users,password_resets and migrations tables. Here migrations table will track of all migrates You can undo previous migration using rollback command php artisan ...