Back to all posts

Git for Real Projects – Complete Office Workflow (Beginner to Advanced)

Chapter 1 – Welcome to Your First Company Story Starts Here... Congratulations! 🎉 Aaj tumne ek software company join ki hai as a SQL Developer. Manager tumh...

Chapter 1 – Welcome to Your First Company

Story Starts Here...

Congratulations! 🎉

Aaj tumne ek software company join ki hai as a SQL Developer.

Manager tumhe laptop deta hai aur bolta hai:

Manager: "Please clone the project and start working on Task #145."

Tum sochte ho...

  • Git kya hai?

  • GitHub kya hai?

  • Clone kya hota hai?

  • Main branch kya hoti hai?

  • Mujhe code kahan likhna hai?

Ye confusion almost har fresher ko hota hai.

Is guide ke end tak tum ye sab confidently kar paoge.


Company Environment

Maan lo company ka naam hai ABC Technologies.

Ek HRMS project chal raha hai.

Project ke modules:

Plain Text
HRMS

├── Employee
├── Payroll
├── Attendance
├── Recruitment
├── Reports
└── Dashboard

Is project par 10 developers kaam kar rahe hain.

Tum Attendance module par kaam karoge.


Team Structure

Plain Text
                 Project Manager

                       │

         ┌─────────────┴─────────────┐

      Team Lead                  QA Team

         │

 ┌───────┼───────────┐

 Dev A   Dev B     You

         │

       GitHub Repository

Sab developers ek hi project par kaam karte hain.

Question:

Agar sab ek hi files edit kare to kya hoga?

Isi problem ko solve karta hai Git.


Without Git

Maan lo tumhare paas project folder hai.

Plain Text
HRMS

Version1

Version2

Version3

Final

Final_New

Latest

Latest_Final

2 hafte baad kisi ko nahi pata chalega ki latest version kaunsa hai.


With Git

Git sari history automatically maintain karta hai.

Plain Text
Commit 1

↓

Commit 2

↓

Commit 3

↓

Commit 4

Kab kisne kya change kiya tha,
sab history me saved hota hai.


Real Office Conversation

Team Lead:

Himanshu, Attendance Report me Employee ID add kar do.

Tum:

Okay.

Ab tum directly coding start nahi karte.

Sabse pehle project download karte ho.


Step 1 – Clone the Project

Manager tumhe repository link bhejta hai.

Plain Text
https://github.com/company/hrms.git

Tum command run karte ho:

Bash
git clone https://github.com/company/hrms.git

Git kya karta hai?

Plain Text
GitHub Repository

        │

        ▼

Your Laptop

        │

        ▼

HRMS Project

Ab poora project tumhare laptop par aa gaya.


Step 2 – Open the Project

Visual Studio

VS Code

Visual Studio Code

Ya koi aur IDE.

Tum project open karte ho.

Folder structure kuch aisa dikhega.

Plain Text
HRMS

├── Controllers

├── Models

├── Views

├── Database

├── Reports

└── README.md

Step 3 – Check Current Branch

Sabse pehle check karo tum kis branch me ho.

Bash
git branch

Output

Plain Text
* main

Matlab tum Main branch me ho.


IMPORTANT

Yahi sabse common mistake hoti hai.

Naye developers directly Main branch me coding start kar dete hain.

Professional companies me aisa nahi hota.

Main branch usually protected hoti hai.

Tum directly usme push nahi kar sakte.


Step 4 – Pull Latest Code

Coding start karne se pehle latest code lena zaroori hota hai.

Bash
git pull origin main

Kyun?

Ho sakta hai kal kisi aur developer ne naye changes kiye ho.

Agar tum latest code nahi loge to baad me merge conflicts aa sakte hain.


Real Office Scenario

Developer A

Morning 9:00

Plain Text
Employee Screen

Developer B

Morning 9:15

Plain Text
Employee Screen

Dono same file edit kar rahe hain.

Agar tum latest code nahi loge,
to shaam ko conflict almost pakka hai.

Isliye har morning pehla command hota hai:

Bash
git pull origin main

Today's Task

JIRA me task mila.

Plain Text
Task #145

Add Employee ID column in Attendance Report.

Ab coding start karne se pehle ek aur important step hota hai.

Feature Branch banana.

Aur yahin se real Git workflow shuru hota hai.


Chapter 1 Summary

Aaj humne seekha:

  • Git company me kyun use hota hai.

  • Git aur GitHub ka basic role.

  • Project clone kaise hota hai.

  • Main branch par direct kaam kyun nahi karna chahiye.

  • Coding se pehle git pull kyun zaroori hai.

  • Real office workflow ki starting.


Chapter 2 – Feature Branch: Coding Start Karne Se Pehle Ye Step Kabhi Skip Mat Karna

Introduction

Pichle chapter me humne dekha ki project clone karne ke baad developer sabse pehle latest code pull karta hai.

Ab ek bahut important question aata hai.

Manager: "Task #145 start kar do."

Ab kya tum main branch me coding start kar doge?

Answer: No.

Real software companies me developers almost kabhi bhi main branch par direct development nahi karte.

Is chapter me hum samjhenge ki Feature Branch kya hoti hai aur har company ise kyun use karti hai.


Real Office Story

Monday Morning - 9:30 AM

Tum office pahuchte ho.

JIRA me ek task assign hua hai.

Plain Text
Task ID : HRMS-145

Description:
Add Employee ID column in Attendance Report.

Tum Team Lead ke paas jaate ho.

You

Sir, task start kar raha hu.

Team Lead

Great.
Pull latest code.
Create a feature branch.
Then start coding.

Notice karo...

Unhone ye nahi bola

Start coding on main branch.


Why Not Main Branch?

Maan lo project me 8 developers kaam kar rahe hain.

Plain Text
               HRMS Project

                     │

       ┌─────────────┼─────────────┐

     Dev A         Dev B         Dev C

       │             │             │

     Login       Payroll      Attendance

Sab alag modules par kaam kar rahe hain.

Agar sab direct main branch me changes push karenge to kya hoga?

  • Bugs aa sakte hain

  • Half completed code production me chala jayega

  • Dusre developers ka code break ho sakta hai

  • Rollback karna difficult ho jayega

Isi liye Feature Branch use hoti hai.


What is a Feature Branch?

Feature Branch ek temporary branch hoti hai jo kisi specific task ke liye banayi jati hai.

Example

Plain Text
main

│

├── feature/login

├── feature/payroll

├── feature/attendance-report

├── feature/export-excel

Har task ki apni branch.

Task complete hone ke baad branch merge kar di jati hai.


Real Example

Tumhara task hai

Plain Text
Add Employee ID in Attendance Report

To tum branch banaoge.

Plain Text
feature/attendance-report

Ya

Plain Text
feature/employee-id-report

Ye branch sirf isi task ke liye hogi.


Branch Naming Convention

Different companies different naming use karti hain.

Example

Plain Text
feature/login
Plain Text
feature/dashboard
Plain Text
bugfix/login-error
Plain Text
hotfix/payment
Plain Text
release/v2.1

Large companies generally task ID bhi include karti hain.

Plain Text
feature/HRMS-145-attendance-report

Ye best practice hai.


Creating a Feature Branch

Sabse pehle latest code lo.

Bash
git pull origin main

Ab branch create karo.

Bash
git switch -c feature/attendance-report

Older Git versions me

Bash
git checkout -b feature/attendance-report

Dono same kaam karte hain.


What Happens Internally?

Pehle

Plain Text
main

Command run

Bash
git switch -c feature/attendance-report

Ab

Plain Text
main

│

└── feature/attendance-report

Tum ab main me nahi ho.

Tum feature branch me ho.


Check Current Branch

Bash
git branch

Output

Plain Text
main

* feature/attendance-report

Star (*) batata hai ki tum currently kis branch me ho.


Folder Kya Duplicate Ho Jata Hai?

Ye beginner ka bahut common question hai.

Answer:

No

Git pura project copy nahi karta.

Git sirf ek naya pointer banata hai.

Example

Plain Text
main

↓

Commit A

↓

Commit B

↓

Commit C

Branch create hui

Plain Text
main

↓

Commit A

↓

Commit B

↓

Commit C

       │

       └── feature/attendance-report

Initially dono same commit ko point karte hain.

Jaise hi tum naye commits karoge, feature branch alag history bana legi.


Coding Start

Ab tum Attendance Report open karte ho.

Before

Plain Text
Employee Name

Department

Attendance

Requirement

Plain Text
Employee ID

Employee Name

Department

Attendance

Tum code modify karte ho.

Example

SQL
SELECT
EmployeeID,
EmployeeName,
Department,
Attendance
FROM AttendanceReport

Abhi ye sirf tumhari branch me hai.

Main branch par koi impact nahi hua.


Another Developer

Isi time Dev B Payroll module par kaam kar raha hai.

Uski branch

Plain Text
feature/payroll-tax

Dev C

Plain Text
feature/login-api

Sab safely parallel development kar rahe hain.

Isi wajah se companies Feature Branch strategy follow karti hain.


Daily Workflow

Har task ke liye almost same process hota hai.

Plain Text
Receive Task

↓

Pull Latest Code

↓

Create Feature Branch

↓

Write Code

↓

Test

↓

Commit

↓

Push

↓

Create Pull Request

↓

Review

↓

Merge

Ye workflow har software company me common hai.


Common Beginner Mistakes

Mistake 1

Coding directly on main branch.

❌ Wrong


Mistake 2

Ek hi branch me 10 alag tasks kar dena.

Example

Plain Text
feature/new-feature

Usme

Login

Payroll

Dashboard

Attendance

Sab kuch.

Ye bahut bada mistake hai.

Har task ki alag branch honi chahiye.


Mistake 3

Branch name

Plain Text
test

Ya

Plain Text
new

Ya

Plain Text
abc

Aise names kabhi use mat karo.

Always meaningful names use karo.

Example

Plain Text
feature/export-excel

Best Practices

✅ Ek task = Ek branch

✅ Branch create karne se pehle latest pull lo

✅ Meaningful branch name use karo

✅ Task complete hone ke baad merge karo

✅ Old feature branches delete kar do


Practice Exercise

Manager assigns you this task:

Plain Text
Task ID : HRMS-182

Add Export to Excel button.

Think and answer:

  1. Branch name kya rakhoge?

  2. Pehla command kya hoga?

  3. Branch create karne ka command kya hoga?

Expected Answer:

Bash
git pull origin main

git switch -c feature/HRMS-182-export-excel

Chapter Summary

Is chapter me humne seekha:

  • Feature Branch kya hoti hai.

  • Companies direct main branch par coding kyun nahi karti.

  • Branch create kaise karte hain.

  • Branch naming convention.

  • Real office workflow.

  • Common mistakes.

  • Best practices.


Chapter 3 – Writing Code and Understanding git status

Introduction

Pichle chapter me humne feature branch create kar li thi.

Ab finally coding start karte hain.

Yahi wo stage hai jahan almost har beginner confuse hota hai.

Questions:

  • Maine file change ki hai, Git ko kaise pata chala?

  • git status kya batata hai?

  • git add kab karna chahiye?

  • Commit kab karna chahiye?

Is chapter ke end tak tum ye sab practically samajh jaoge.


Real Office Story

Tuesday Morning

Manager ne tumhe task diya hai.

Plain Text
Task ID : HRMS-145

Add Employee ID column in Attendance Report.

Tum feature branch me ho.

Bash
git branch

Output

Plain Text
main

* feature/HRMS-145-attendance-report

Ab coding start karte hain.


Existing SQL Query

Project me ek Stored Procedure hai.

SQL
CREATE PROCEDURE SP_AttendanceReport
AS
BEGIN

SELECT
EmployeeName,
Department,
AttendanceDate,
Status

FROM Attendance

END

Requirement aayi hai

Employee ID bhi report me dikhna chahiye.

Tum query modify karte ho.

SQL
CREATE PROCEDURE SP_AttendanceReport
AS
BEGIN

SELECT
EmployeeID,
EmployeeName,
Department,
AttendanceDate,
Status

FROM Attendance

END

Bas itna change kiya hai.

Question:

Git ko kaise pata chalega ki file change hui hai?


Git Constantly Watches Files?

No.

Ye beginner ki sabse common misunderstanding hai.

Git continuously tumhari files monitor nahi karta.

Jab tum command chalate ho

Bash
git status

Tab Git current files ko last commit se compare karta hai.


First Command After Coding

Har developer almost har 10–15 minute me ye command chalata hai.

Bash
git status

Output

Plain Text
On branch feature/HRMS-145-attendance-report

Changes not staged for commit

modified:

AttendanceReport.sql

Ab iska meaning samajhte hain.


Meaning of "Modified"

Plain Text
Last Commit

↓

AttendanceReport.sql

Tumne file edit ki.

Ab

Plain Text
Current File

↓

AttendanceReport.sql (Modified)

Git bol raha hai

"Mujhe pata chal gaya hai ki ye file last commit ke baad change hui hai."

Lekin...

Abhi ye commit ka part nahi hai.


Working Directory

Ab ek bahut important concept.

Git me teen areas hote hain.

Plain Text
Working Directory

↓

Staging Area

↓

Repository

1. Working Directory

Ye tumhara actual project folder hota hai.

Example

Plain Text
HRMS

│

├── AttendanceReport.sql

├── Employee.sql

├── Payroll.sql

Yahin tum coding karte ho.


2. Staging Area

Ye ek temporary waiting room hai.

Git yahan poochta hai

Kya tum sure ho ki ye changes next commit me include karne hain?


3. Repository

Yahan permanent history save hoti hai.


Visual Example

Coding complete.

Plain Text
Working Directory

AttendanceReport.sql

(Modified)

Command

Bash
git add AttendanceReport.sql

Ab

Plain Text
Working Directory

↓

Staging Area

Abhi bhi commit nahi hua.

Sirf ready hua hai.


Why Staging Area?

Question

Direct commit kyun nahi?

Suppose tumne 5 files change ki.

Plain Text
AttendanceReport.sql

Employee.sql

Payroll.sql

Dashboard.js

README.md

Lekin commit me sirf AttendanceReport.sql bhejni hai.

To?

Bash
git add AttendanceReport.sql

Bas wahi file stage hogi.

Baaki nahi.

Ye bahut powerful feature hai.


Stage Current Changes

Command

Bash
git add AttendanceReport.sql

Ya sab files

Bash
git add .

Ab dobara status dekho.

Bash
git status

Output

Plain Text
Changes to be committed

modified:

AttendanceReport.sql

Notice difference.

Pehle tha

Plain Text
Changes not staged

Ab hai

Plain Text
Changes to be committed

Matlab

Ye file next commit me jayegi.


Real Office Example

Suppose tumne galti se

Plain Text
AttendanceReport.sql

Aur

Plain Text
appsettings.json

Dono change kar diye.

Status

Plain Text
modified:

AttendanceReport.sql

modified:

appsettings.json

Tumhe sirf report wali file commit karni hai.

Command

Bash
git add AttendanceReport.sql

Ab sirf wahi stage hogi.


Common Beginner Mistake

Har baar

Bash
git add .

Ye blindly mat chalao.

Kabhi kabhi unwanted files bhi stage ho jati hain.

Example

Plain Text
.config

temp files

logs

backup files

Commit me chale jayenge.

Professional developers pehle status dekhte hain.


Create First Commit

Ab changes stage ho chuke hain.

Command

Bash
git commit -m "Added Employee ID in attendance report"

Output

Plain Text
1 file changed

1 insertion(+)

Congratulations!

Tumhara pehla office task history me save ho gaya.


Good Commit Message

Bad

Plain Text
Update

Bad

Plain Text
Changes

Bad

Plain Text
Done

Good

Plain Text
Added Employee ID in attendance report

Good

Plain Text
Fixed duplicate attendance issue

Good

Plain Text
Added export to Excel feature

Commit message padhkar samajh aa jana chahiye ki kya change hua.


Check History

Command

Bash
git log --oneline

Output

Plain Text
5f2ad1 Added Employee ID in attendance report

c61a22 Initial Commit

Ab Git ki history update ho chuki hai.


Office Workflow Till Now

Plain Text
Receive Task

↓

Pull Latest Code

↓

Create Branch

↓

Write Code

↓

git status

↓

git add

↓

git commit

Abhi code sirf tumhare laptop me hai.

GitHub par nahi gaya.

Wo next chapter me dekhenge.


Common Mistakes

Mistake 1

Commit bina status dekhe.

Wrong.

Always

Bash
git status

Mistake 2

Huge commit.

Ek commit me

  • Login

  • Payroll

  • Attendance

  • Dashboard

Sab.

Wrong.

Ek logical task = Ek commit.


Mistake 3

Meaningless commit message.

Plain Text
Update

Wrong.


Best Practices

✅ Frequent commits karo.

✅ Har commit ek logical change represent kare.

✅ Commit message meaningful likho.

✅ Commit se pehle status check karo.

✅ Sirf required files stage karo.


Interview Question

Why do we use git status so frequently?

Sample Answer

git status shows the current state of the repository. It tells us which files are modified, staged, or untracked. Developers use it frequently to ensure that only the intended files are committed.


Practice Exercise

Tumne ye files modify ki hain.

Plain Text
AttendanceReport.sql

Employee.sql

README.md

Sirf AttendanceReport.sql commit karni hai.

Questions

  1. Status dekhne ka command?

  2. Sirf ek file stage karne ka command?

  3. Commit command?

Expected Answer

Bash
git status

git add AttendanceReport.sql

git commit -m "Added Employee ID in attendance report"

Chapter Summary

Aaj humne seekha:

  • Git modified files kaise identify karta hai.

  • git status ka actual purpose.

  • Working Directory kya hoti hai.

  • Staging Area kyun hoti hai.

  • git add ka use.

  • Meaningful commit messages ka importance.

  • Real office workflow me commit kaise hota hai.


Chapter 4 – Git Push: Code Laptop Se GitHub Tak Kaise Jata Hai?

Introduction

Pichle chapter me humne apna pehla commit create kiya.

Plain Text
Receive Task

↓

Create Branch

↓

Write Code

↓

git add

↓

git commit

Ab ek important question hai.

Kya commit karte hi code GitHub par chala jata hai?

Answer: No.

Ye beginner ki sabse common misunderstanding hai.

git commit sirf tumhare laptop par history save karta hai.

GitHub par code bhejne ke liye alag command hoti hai.

SQL
git push

Is chapter me hum ye complete process samjhenge.


Real Office Story

Wednesday Morning

Tumne apna task complete kar liya.

Attendance Report me Employee ID successfully add ho gaya.

Tum Team Lead ko bolte ho.

You: Sir, task complete ho gaya.

Lead bolta hai.

Team Lead: Great. Push your code and create a Pull Request.

Ab tum sochte ho...

Push kya hota hai?


Local Repository vs Remote Repository

Sabse pehle ye difference samajhna bahut zaroori hai.

SQL
Your Laptop

↓

Local Git Repository

Aur

SQL
GitHub

↓

Remote Repository

Dono alag jagah hain.

Example

SQL
Your Laptop

Commit 1

Commit 2

Commit 3

GitHub

SQL
Commit 1

Commit 2

Abhi Commit 3 sirf tumhare laptop me hai.

GitHub ko uske baare me kuch nahi pata.


How Code Travels?

SQL
Write Code

↓

git add

↓

git commitLocal Repository

↓

git push

↓

GitHub

Ye complete workflow har developer roz use karta hai.


Check Current Remote

Sabse pehle check karte hain ki project kis GitHub repository se connected hai.

Command

Bash
git remote -v

Output

Plain Text
origin  https://github.com/company/hrms.git (fetch)

origin  https://github.com/company/hrms.git (push)

Question

Ye "origin" kya hai?


What is Origin?

Origin sirf ek nickname hai.

Real URL

SQL
https://github.com/company/hrms.git

Git ise yaad rakhne ke liye

SQL
origin

naam de deta hai.

Isliye hum likhte hain

Bash
git push origin feature/HRMS-145-attendance-report

Na ki

Bash
git push https://github.com/company/hrms.git

Origin likhna easy hai.


First Push

Tum apni feature branch par ho.

Check karo.

Bash
git branch

Output

Plain Text
main

* feature/HRMS-145-attendance-report

Ab push karo.

Bash
git push origin feature/HRMS-145-attendance-report

Output

Plain Text
Enumerating objects...

Counting objects...

Writing objects...

Done

Congratulations!

Ab tumhara code GitHub par upload ho gaya.


Visual Workflow

Before Push

SQL
Laptop

Commit A

Commit B

Commit C

GitHub

SQL
Commit A

Commit B

After Push

SQL
Laptop

Commit A

Commit B

Commit C

GitHub

SQL
Commit A

Commit B

Commit C

Ab dono same state me hain.


What Happens Internally?

Git compare karta hai.

Laptop

SQL
Commit 1

Commit 2

Commit 3

GitHub

SQL
Commit 1

Commit 2

Git dekhta hai

Sirf Commit 3 missing hai.

To sirf wahi upload hota hai.

Pura project dobara upload nahi hota.

Isi wajah se Git bahut fast hai.


Office Scenario

Tumhari team me teen developers hain.

Developer A

SQL
feature/login

Developer B

SQL
feature/payroll

Tum

SQL
feature/HRMS-145-attendance-report

Teenon apni apni branches push karte hain.

GitHub

SQL
main

feature/login

feature/payroll

feature/HRMS-145-attendance-report

Sabka code safely separate branches me rehta hai.


Very Important

Push karne ke baad bhi

Main branch change nahi hoti.

Ye beginner ki dusri common misunderstanding hai.

Before

SQL
main

↓

Commit A

↓

Commit B

Tumhari Branch

SQL
feature/HRMS-145Commit C

Push ke baad bhi

SQL
main

↓

Commit A

↓

Commit B

Feature Branch

SQL
feature/HRMS-145Commit C

Main branch tab tak update nahi hogi jab tak Pull Request merge nahi hoti.


Verify Push

GitHub open karo.

Tumhari branch dikhne lagegi.

SQL
Branches

main

feature/login

feature/payroll

feature/HRMS-145-attendance-report

Ab Team Lead tumhara code dekh sakta hai.


Common Push Errors

Error 1

SQL
error: failed to push some refs

Reason

Kisi aur developer ne tumse pehle code push kar diya.

Solution

Bash
git pull

Latest changes lo.

Conflicts resolve karo.

Phir

Bash
git push

Error 2

SQL
Permission denied

Reason

GitHub login issue

Ya repository access nahi hai.


Error 3

SQL
src refspec does not match any

Reason

Branch ka naam galat.

Ya commit hi nahi hua.


Common Beginner Mistakes

❌ Push before commit.

SQL
git push

Commit hi nahi kiya.

Obviously kuch upload nahi hoga.


❌ Main branch me push.

SQL
git push origin main

Office me usually allowed hi nahi hota.


❌ Wrong branch push.

Current branch

SQL
feature/login

Push

SQL
feature/payroll

Result

Confusion.


Best Practices

✅ Push karne se pehle

SQL
git status

Run karo.


✅ Meaningful commits banao.


✅ Correct branch verify karo.

SQL
git branch

✅ Push ke baad GitHub par branch verify karo.


Real Office Conversation

Developer

Sir, code complete hai.

Lead

Commit kiya?

Developer

Yes.

Lead

Push kiya?

Developer

Yes.

Lead

PR raise kar do.

Notice karo.

Commit aur Push alag steps hain.


Chapter 5 – Pull Request (PR): Team Lead Tumhara Code Kaise Review Karta Hai?

Introduction

Pichle chapter me humne apna code GitHub par push kar diya.

Workflow abhi tak:

Plain Text
Receive Task

↓

Create Feature Branch

↓

Write Code

↓

git add

↓

git commit

↓

git push

Ab ek question aata hai.

Kya push karte hi code production me chala jata hai?

Answer: Bilkul nahi.

Software companies me push karna sirf ek step hai.

Uske baad aata hai Pull Request (PR).


Real Office Story

Thursday Morning

Tumne Attendance Report ka task complete kar diya.

Tum Team Lead ko message karte ho.

You: Sir, code push kar diya.

Lead reply karta hai.

Team Lead: Great. Raise a Pull Request.

Tum sochte ho...

Pull Request kya hoti hai?


What is a Pull Request?

Simple language me:

Pull Request ek request hoti hai jisme tum Team Lead se bolte ho:

"Maine feature complete kar diya hai. Please mera code review karke agar sab sahi ho to main branch me merge kar dijiye."

PR directly merge nahi karta.

PR sirf review ke liye request bhejta hai.


Real Life Example

Maan lo tumne school assignment complete kiya.

Kya teacher bina dekhe marks de deta hai?

Nahi.

Teacher pehle assignment check karta hai.

GitHub me bhi same hota hai.

Plain Text
Developer

↓

Code Complete

↓

Pull Request

↓

Team Lead Review

↓

Approved

↓

Merge

Current Situation

GitHub me branches:

Plain Text
main

feature/login

feature/payroll

feature/HRMS-145-attendance-report

Tumhari branch me changes hain.

Main branch abhi bhi old version par hai.


Create Pull Request

GitHub open karo.

Tumhe message dikhega.

Plain Text
feature/HRMS-145-attendance-report had recent pushes

Compare & Pull Request

Click karo.


Fill PR Details

Title

Plain Text
Add Employee ID column in Attendance Report

Description

Plain Text
Task ID : HRMS-145

Changes Done

- Added Employee ID in Attendance Report
- Updated Stored Procedure
- Updated Report Layout

Testing

- SQL Query Tested
- Report Validated

Good PR description reviewer ka time bachati hai.


Assign Reviewer

Company me generally reviewer hota hai.

Example

Plain Text
Reviewer

Rahul Sharma

Ya

Plain Text
Team Lead

Ab reviewer ko notification mil jayegi.


What Does Team Lead Do?

Lead PR open karta hai.

Usse sirf final output nahi dikhta.

Usse har line ka difference dikhta hai.

Example

Before

SQL
SELECT
EmployeeName,
Department,
AttendanceDate

After

SQL
SELECT
EmployeeID,
EmployeeName,
Department,
AttendanceDate

GitHub highlight karta hai.

Plain Text
+ EmployeeID

Reviewer ko turant pata chal jata hai ki kya change hua hai.


Code Review

Lead code padh raha hai.

Usse ek issue dikha.

Comment karta hai.

Please use EmployeeCode instead of EmployeeID.

Ya

Query optimization required.

Ya

Please add comments.

PR reject nahi hua.

Sirf changes request hui hain.


What Should You Do?

Kabhi bhi naya PR mat banao.

Existing branch me hi changes karo.

Example

SQL
SELECT
EmployeeCode,
EmployeeName,
Department

Save.

Commit.

Bash
git add AttendanceReport.sql

git commit -m "Updated EmployeeCode based on review comments"

Push.

Bash
git push

Bas.

PR automatically update ho jayegi.

Ye bahut important concept hai.


Common Beginner Mistake

Naye developers sochte hain.

Comment aa gaya.

Chalo naya Pull Request bana dete hain.

❌ Wrong

Ek hi PR me changes continue karte hain.


Reviewer Approves

Lead fir se code dekhta hai.

Sab sahi hai.

Click karta hai.

Plain Text
Approve

Ab PR green ho gayi.


Merge

Approval ke baad.

Plain Text
Merge Pull Request

Click.

Ab

Plain Text
feature/HRMS-145-attendance-report

ke commits

Plain Text
main

me aa gaye.


Visual Flow

Before Merge

Plain Text
main

↓

Commit A

↓

Commit B

Feature Branch

Plain Text
Commit A

↓

Commit B

↓

Commit C

After Merge

Plain Text
main

↓

Commit A

↓

Commit B

↓

Commit C

Ab main update ho gayi.


Delete Feature Branch

Task complete.

Ab feature branch ki zarurat nahi.

GitHub usually option deta hai.

Plain Text
Delete Branch

Ye best practice hai.

Kyuki ek project me hazaron old branches nahi rakhni chahiye.


Local Cleanup

Merge ke baad latest code lo.

Bash
git switch main
Bash
git pull origin main

Delete local branch.

Bash
git branch -d feature/HRMS-145-attendance-report

Ab tum next task ke liye ready ho.


Complete Office Workflow

Plain Text
Task Assigned

↓

Pull Latest Code

↓

Create Feature Branch

↓

Write Code

↓

git status

↓

git add

↓

git commit

↓

git push

↓

Create Pull Request

↓

Code Review

↓

Fix Review Comments

↓

git commit

↓

git push

↓

Approve

↓

Merge

↓

Delete Branch

↓

Pull Latest Main

Ye workflow almost har software company follow karti hai.

Ye bahut accha idea hai. Niche maine real office workflow ke hisab se Git commands ko sequence me arrange kiya hai. Agar tum SQL Developer ya Data Engineer ho to office me lagbhag isi order me ye commands use karoge.

Step

Command

Matlab (Hindi)

Kab Use Karte Hain

Real Project Example

1

git --version

Git install hai ya nahi check karna

First time

Naye laptop par Git verify karna

2

git config --global user.name "Himanshu"

User name set karna

First setup

Pehli baar Git configure karna

3

git config --global user.email "abc@gmail.com"

Email set karna

First setup

Commit author set karna

4

git config --list

Current configuration dekhna

Verification

Check karna ki name/email sahi hai

5

git clone <url>

GitHub se project download karna

Company join karne ke baad

HRMS project clone karna

6

git remote -v

Repository kis GitHub se connected hai

Clone ke baad

Origin URL verify karna

7

git branch

Available branches dekhna

Daily

Main aur feature branches dekhna

8

git switch main

Main branch par jana

New task se pehle

Latest code lene ke liye

9

git pull origin main

Latest code download karna

Roz subah

Team ke latest changes lena

10

git switch -c feature/HRMS-145

Nayi feature branch banana

Naya task

Attendance report feature

11

git status

Repository ki current state dekhna

Coding ke baad

Kaunsi files modified hain

12

git diff

File me kya change hua dekhna

Commit se pehle

SQL query compare karna

13

git add FileName

Ek file stage karna

Commit se pehle

Attendance.sql stage karna

14

git add .

Sab files stage karna

Jab sab changes commit karne ho

Chhote project me

15

git restore FileName

File ke uncommitted changes hata dena

Galti se edit ho gaya

SQL file restore karna

16

git restore --staged FileName

Staging se file hata dena

Galat file stage ho gayi

appsettings.json remove karna

17

git commit -m "message"

Changes history me save karna

Task complete

"Added Employee ID"

18

git log

Complete history dekhna

Audit

Sare commits dekhna

19

git log --oneline

Short history

Daily

Recent commits dekhna

20

git push origin feature/HRMS-145

GitHub par code bhejna

Commit ke baad

PR banane se pehle

21

GitHub PR

Pull Request banana

Push ke baad

Review ke liye

22

git switch main

Main branch par wapas jana

PR merge ke baad

Next task ke liye

23

git pull origin main

Merged code lena

PR merge ke baad

Latest main update karna

24

git branch -d feature/HRMS-145

Local branch delete karna

Task complete

Cleanup


⚠ Merge Conflict Commands

Command

Matlab

Kab Use Hota Hai

git status

Conflict wali files dekhna

Merge conflict ke baad

git add FileName

Conflict resolve hone ke baad stage karna

Resolve ke baad

git commit

Merge complete karna

Conflict fix hone ke baad

git merge --abort

Merge cancel karna

Agar merge nahi karna


📂 Branch Commands

Command

Matlab

git branch

Branch list

git branch branch-name

New branch banana

git switch branch-name

Branch change karna

git switch -c branch-name

Branch create + switch

git checkout branch-name

Purana tarika branch switch karne ka

git branch -d branch-name

Local branch delete

git branch -D branch-name

Force delete


🔄 History Commands

Command

Matlab

git log

Complete history

git log --oneline

Short history

git show

Last commit details

git reflog

Sab actions ki history


↩ Undo Commands

Command

Matlab

Use Case

git restore file

File restore

Commit se pehle

git restore --staged file

Unstage

Galat file stage ho gayi

git reset --soft HEAD~1

Commit remove, changes bachaye

Message galat ho gaya

git reset --mixed HEAD~1

Commit remove + unstage

Default reset

git reset --hard HEAD~1

Sab delete

Dangerous

git revert commit-id

Commit ko reverse karna

Production safe


🌐 Remote Commands

Command

Matlab

git remote -v

Remote URL dekhna

git remote add origin URL

Remote connect karna

git fetch

Sirf latest info lana

git pull

Fetch + Merge

git push

GitHub par upload


📦 File Commands

Command

Matlab

git mv old new

File rename

git rm file

File delete

git clean -fd

Untracked files delete


🚀 Advanced Commands

Command

Matlab

git stash

Temporary changes save

git stash pop

Stash wapas lana

git stash list

Stash list

git tag

Release version banana

git rebase

Clean history banana

git cherry-pick commit-id

Ek commit copy karna


📅 Real Office Daily Workflow

Time

Command

Purpose

9:00 AM

git switch main

Main branch par aana

9:01 AM

git pull origin main

Latest code lena

9:02 AM

git switch -c feature/task-name

New feature branch

Coding

git status

Changes check karna

Coding

git diff

Changes verify karna

After Coding

git add .

Stage changes

After Coding

git commit -m "message"

Local save

After Coding

git push origin feature/task-name

GitHub upload

GitHub

Pull Request

Review ke liye

After Merge

git switch main

Main par aana

After Merge

git pull origin main

Latest merged code

Cleanup

git branch -d feature/task-name

Branch delete

Is table me lagbhag 95% commands cover ho gayi hain jo ek SQL Developer, Data Engineer, Backend Developer ya Software Engineer roz use karta hai. Advanced commands (bisect, worktree, submodule, etc.) specific scenarios me use hote hain aur daily workflow ka hissa nahi hote.

0 likes

Rate this post

No rating

Tap a star to rate

0 comments

Latest comments

0 comments

No comments yet.

Keep building your data skillset

Explore more SQL, Python, analytics, and engineering tutorials.