Mastering Git, GitHub, and GitLab – Version Control from Basics to DevOps”
📚 Chapter Breakdown Plan:
Chapter | Title |
1️⃣ | What is Git? – Version Control Explained Simply |
2️⃣ | Git Basic Commands – Clone, Commit, Push, Pull in Action |
3️⃣ | What is GitHub? – Hosting, Collaboration, and Actions |
4️⃣ | GitLab vs GitHub – What’s the Difference? |
5️⃣ | Using Git in Real Projects (with VS Code + Terminal) |
6️⃣ | Git Branching, Merging, and Conflict Resolution |
7️⃣ | GitHub & GitLab for QA/Test Automation |
8️⃣ | Common Git Errors & Fixes (Nepali-English Troubleshooting) |
🔹 Chapter 1: What is Git? – Version Control Explained Simply
Git भनेको के हो? Version Control लाई सजिलो भाषामा बुझौँ।
📖 Introduction
Git भनेको एक version control system हो, जसले code को history manage गर्छ। तपाईंले project मा कति पटक परिवर्तन गर्नुभयो, कुन file change भयो, कसले commit गर्यो — यी सबै Git ले track गर्छ।
🔁 “Git helps you rewind, compare, merge, and collaborate on code — just like a time machine for developers.”
🧠 Why Use Git?
काम | Git बिना | Git सँग |
✅ File save/backup | Manually | Automatically version track हुन्छ |
✅ Team collaboration | Conflicts आउँछ | Merge/branch system ले manage गर्छ |
✅ Mistake undo | Hard to recover | Easy rollback with commit ID |
✅ Deployment-ready code | Difficult to track | Stable branches maintain गर्न सकिन्छ |
🛠️ Git ले के गर्छ?
- Local Repo बनाउँछ – तपाईंको computer भित्र code को version राख्छ।
- Changes track गर्छ – कुन file कहिले change भयो भनेर Git ले याद राख्छ।
- History देखाउँछ – तपाईंले गरेको पुराना कामहरू log मार्फत हेर्न सक्नुहुन्छ।
- Collaboration सजिलो बनाउँछ – GitHub वा GitLab सँग मिलेर धेरै developer एकै project मा काम गर्न सक्छन्।
📦 Git को Structure (Simplified)
mathematica
CopyEdit
Working Directory → Staging Area → Local Repository → Remote Repository (GitHub/GitLab)
🧪 Real-Life Example (Nepali-English Context)
तपाईंले एउटा वेबसाइटमा header change गर्नुभयो —
Git ले त्यो परिवर्तन commit मा राख्छ। पछि तपाईं compare गर्न सक्नुहुन्छ, कस्तो थियो र कस्तो बन्यो भनेर।
🎯 Key Concepts
Term | Meaning |
git init | नया Git repo सुरु गर्ने command |
git add | file लाई staging मा राख्ने |
git commit | saved change history बनाउने |
git push | GitHub मा code पठाउने |
git pull | GitHub बाट नया code ल्याउने |
git status | के के change भयो हेर्ने command |
📌 Conclusion: Git ले तपाईंलाई तपाईंको code को इतिहासमा confident बनाउँछ — गल्ती भए पनि, तपाईं सधैं rollback गर्न सक्नुहुन्छ।
🔹 Chapter 2: Git Basic Commands – Clone, Commit, Push, Pull in Action
Git का मुख्य command हरू — Clone, Commit, Push, Pull प्रयोग गरौँ step-by-step
📖 Introduction
Git मा काम गर्न जान्नुपर्ने मुख्य चार command हरू हुन्:
👉 clone, commit, push, pull
यी command हरूले तपाईंलाई code locally राख्न, commit history बनाउँन, GitHub वा GitLab सँग sync गर्न, र teammate को काम ल्याउन मद्दत गर्छ।
🧪 Scenario: QA Project with GitHub
तपाईंले GitHub मा एक automation project देख्नुभयो। अब तपाईंले त्यो code आफ्नो system मा ल्याएर test case commit गर्नुछ।
🔧 Step-by-Step Commands
🔸 1. git clone
Use: Remote GitHub/GitLab repo लाई आफ्नो local machine मा download गर्न
bash
CopyEdit
git clone https://github.com/username/project.git
✅ यो command पछि तपाईंको folder मा complete project copy हुन्छ।
🔸 2. git status
Use: File मा कति change भयो भनेर check गर्न
bash
CopyEdit
git status
✅ Modified files, untracked files सबै देखाउँछ।
🔸 3. git add
Use: कुन file commit गर्ने भनेर Git लाई बताउने
bash
CopyEdit
git add filename.java
# या सबै file add गर्न
git add .
✅ Add गरेको file मात्रै commit मा जान्छ।
🔸 4. git commit
Use: Final version तयार गरी Git मा save गर्ने
bash
CopyEdit
git commit -m “Added login test case”
✅ Message clearly लेख्नु राम्रो practice हो।
🔸 5. git push
Use: Local commit लाई GitHub वा GitLab मा पठाउने
bash
CopyEdit
git push origin main
✅ अब तपाईंको teammates ले GitHub मा तपाईंको काम देख्न सक्छन्।
🔸 6. git pull
Use: अरूले commit गरेको नया code आफ्नो machine मा ल्याउने
bash
CopyEdit
git pull origin main
✅ Frequent pull गर्नाले conflict कम हुन्छ।
📦 Bonus Commands
Command | Purpose |
git log | Commit history हेर्न |
git branch | कुन branch मा छ भनेर थाहा पाउन |
git checkout -b name | नया branch बनाउन |
📌 Real-Life Use Case (QA Example)
- Clone automation framework from GitHub
- Add new test case in LoginTest.java
- Use git add, git commit, and git push
- Teammates pull your update and run the test
🔁 Git ले testing workflow लाई structured, safe, र collaborative बनाउँछ।
🔹 Chapter 3: What is GitHub? – Hosting, Collaboration, and Actions
GitHub भनेको के हो? Version control hosting, team collaboration र automation को संसार
📖 Introduction
GitHub एक cloud-based platform हो जसले Git repository हरूलाई host, manage र collaborate गर्न सजिलो बनाउँछ।
यो platform मा तपाईंले code राख्न, teammate सँग काम बाँड्न, bug track गर्न, pull request review गर्न र automation workflow बनाउन सक्नुहुन्छ।
☁️ GitHub is like your team’s cloud-based code office – secure, sharable, and smart.
🔧 Key Features of GitHub
Feature | Purpose |
📁 Repository Hosting | Git project लाई cloud मा सुरक्षित राख्ने |
👨👩👧👦 Collaboration | Multiple testers/devs एउटै repo मा काम गर्न सक्ने |
🔁 Pull Requests | Code review र merge process handle गर्न |
🧪 Issues & Labels | Bug/feature discussion track गर्न |
🤖 GitHub Actions | CI/CD automation चलाउन (test, deploy, etc.) |
🧪 Example Workflow (QA Team)
- QA Engineer fork गर्छ main repo
- Code/test case लेखेर push गर्छ
- Pull request create गर्छ
- Team member ले review गर्छ
- Merge गरेपछि test GitHub Action बाट चल्छ
📂 GitHub Repository Structure
plaintext
CopyEdit
/automation-project
├── tests/
├── pom.xml / package.json
├── README.md
├── .gitignore
└── workflows/
✅ README.md: Project intro
✅ .gitignore: Unwanted files exclude गर्ने
✅ workflows/: GitHub Actions automation
🔁 What is a Pull Request?
Pull Request (PR) भनेको:
- तपाईंले code change गरेपछि teammate लाई review गर्न पठाउने process हो।
- यो code merge गर्नु अघि communication र safety को लागि उपयोगी हुन्छ।
🤖 What is GitHub Actions?
GitHub Actions ले CI/CD automation चलाउँछ:
- Code push भएपछिको test run
- Report generate
- Build + Deploy automatically
Example YAML file:
yaml
CopyEdit
name: Run Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
– uses: actions/checkout@v2
– run: mvn test
🎯 Why QA/Testers Should Use GitHub
Advantage | Impact |
📚 Centralized QA Code | सबै test case Git मा organize हुन्छ |
👥 Team-based Review | हर commit लाई verify गर्न सकिन्छ |
🤝 Collaboration Boost | Manual + Automation testers सँग सहकार्य सजिलो |
🔄 Integration Ready | Jenkins, Selenium, Postman, Allure सँग sync हुन्छ |
✅ Conclusion: GitHub QA teams को लागि version control मात्र होइन, testing efficiency, collaboration, र automation को foundation हो।
🔹 Chapter 4: GitLab vs GitHub – What’s the Difference?
GitLab र GitHub बीचको मुख्य फरक के हो? QA टीमका लागि कुन उपयुक्त हुन्छ?
📖 Introduction
GitLab र GitHub दुवै Git-based version control platform हुन् — जसले code host, manage, collaborate, र deploy गर्न सहयोग गर्छन्।
तर दुबैले आफ्नो feature, pricing, workflow, र integration ecosystem मा केही फरक राख्छन्।
🤝 GitHub world’s most popular open-source platform हो भने, GitLab DevOps-centric all-in-one platform हो।
🔍 Quick Comparison Table
Feature | GitHub | GitLab |
🏢 Owner | Microsoft | GitLab Inc. (Open core) |
💻 Code Hosting | Yes (Git) | Yes (Git) |
🤝 Collaboration | Pull Request system | Merge Request system |
🤖 CI/CD | GitHub Actions | Built-in CI/CD pipelines |
🔒 Private Repo (Free) | ✅ Yes (Unlimited) | ✅ Yes (Unlimited) |
🛠️ DevOps Tools | Third-party integration mostly | Everything built-in (Dev → Deploy) |
📊 Project Analytics | Limited (advanced via Pro) | Advanced analytics + test report |
🌐 Self-hosting Option | ❌ Cloud only | ✅ Yes (cloud & self-managed) |
👥 Target Users | Open-source + enterprise dev teams | DevOps teams needing end-to-end control |
🎯 Use Cases Based on QA Needs
Scenario | Recommended Tool |
✅ Open-source collaboration | GitHub |
✅ Large DevOps automation setup | GitLab |
✅ Simpler UI for beginner testers | GitHub |
✅ On-premise requirement | GitLab |
✅ Built-in test dashboard needed | GitLab |
🧪 QA Perspective
Task | GitHub | GitLab |
🧪 Trigger test on commit | GitHub Actions | GitLab CI/CD (built-in) |
📄 Test report summary | Manual integration or 3rd party | Native HTML + JUnit + Coverage reports |
🧠 Security testing | Add-on or marketplace | Built-in SAST, DAST available |
🗣️ Final Thought in Nepali-English
यदि तपाईं QA को रूपमा एकदमै DevOps-integrated workflow चाहनुहुन्छ भने GitLab उत्तम हो।
तर यदि तपाईं code hosting र lightweight CI मात्र खोजिरहनु भएको छ भने GitHub पर्याप्त हुन्छ।
🔹 Chapter 5: Using Git in Real Projects (VS Code + Terminal)
Real Project मा Git कसरी प्रयोग गर्ने? VS Code र Terminal बाट step-by-step workflow
📖 Introduction
Git सिक्नुभन्दा महत्वपूर्ण कुरा हो — practical मा Git कसरी प्रयोग गर्ने।
यस अध्यायमा, तपाईंले देख्नुहुनेछ कसरी एक real QA automation project मा Git प्रयोग गरेर test case version control गर्न सकिन्छ — using VS Code र Terminal।
💡 Learning Git visually and practically makes it 10x easier to master.
🧱 Prerequisites
- ✅ Git installed on your system
- ✅ VS Code installed
- ✅ GitHub account (with an existing repo or forked one)
- ✅ Basic project (e.g., Selenium test folder or Java Maven project)
🧪 Step-by-Step Git Workflow in VS Code
🔸 Step 1: Clone a Project from GitHub
Open terminal (inside VS Code) and run:
bash
CopyEdit
git clone https://github.com/yourusername/yourproject.git
📁 VS Code मा folder खुल्यो भने sidebar मा तपाईंको project देखिन्छ।
🔸 Step 2: Make a Change
Open LoginTest.java or any test file → add/update your test case.
🔸 Step 3: Stage Your Change
Either via terminal:
bash
CopyEdit
git add .
or click the Source Control icon in VS Code and hit the ➕ icon next to changed files.
🔸 Step 4: Commit with Message
bash
CopyEdit
git commit -m “✅ Added login test with valid credentials”
🎯 Message मा emoji प्रयोग गरे पनि मिल्छ — readability बढाउँछ।
🔸 Step 5: Push to GitHub
bash
CopyEdit
git push origin main
अब GitHub मा तपाईंको नया commit देखिन्छ।
🔸 Step 6: Pull Teammate’s Change
bash
CopyEdit
git pull origin main
✅ यसले merge conflict हुन नदिन मद्दत गर्छ।
🖥️ Optional: VS Code Git Integration
- 🔄 Auto fetch updates
- 🧪 GitLens extension ले commit history, blame view देखाउँछ
- 💬 GitHub pull requests review VS Code बाटै गर्न सकिन्छ
💡 Tips for QA/Testers
Task | Git Use |
✍️ Test case commit गर्नु | Use git add + commit + push |
🧪 Test run logs share गर्नु | Commit in /logs or share via .md |
🧼 Conflict resolve गर्नु | Use git pull and merge via VS Code |
🔖 Version tracking गर्नु | Use branches per feature/test module |
📌 Summary
Git with VS Code offers a visual, beginner-friendly way to collaborate on real testing projects. Whether you’re:
- Committing Selenium test cases
- Reviewing test logs
- Merging regression suite changes
👉 Git makes your QA life more structured and professional.
🔹 Chapter 6: Git Branching, Merging, and Conflict Resolution
Git मा Branch कसरी बनाउने, Merge कसरी गर्ने, र Conflict कसरी मिलाउने?
📖 Introduction
QA project मा एकै code मा धेरै tester/developer ले काम गर्दा, conflict नहोस् भनेर branching strategy अपनाइन्छ।
Git को branch system ले तपाईंलाई अलग-अलग version मा काम गर्न दिन्छ, र merge गरेर final version तयार पार्न सहयोग गर्छ।
🌿 Think of each branch as a safe playground — test, build, and only merge when it’s ready.
🔍 What is a Branch in Git?
A branch is a copy of your code where you can work independently without affecting the main (or production) code.
- main or master → stable version
- feature/login-test → work in progress (QA test case for login)
🛠️ Step-by-Step: Create & Use Git Branches
🔸 1. Check current branch:
bash
CopyEdit
git branch
🔸 2. Create new branch:
bash
CopyEdit
git checkout -b login-test
✅ -b flag ले नयाँ branch बनाउँछ र switch पनि गर्छ।
🔸 3. Work, commit, and push:
bash
CopyEdit
git add .
git commit -m “Added login test”
git push origin login-test
🔀 Merging a Branch (When Test Case is Finalized)
- Switch to main branch:
bash
CopyEdit
git checkout main
- Merge changes:
bash
CopyEdit
git merge login-test
✅ अब login-test को सबै commits main मा मिसिन्छ।
⚠️ Conflict Explained (When Two Branches Edit Same Line)
Condition | Result |
Same file edited by two branches | Git can’t auto-decide |
Merge attempt triggers ⚠️ conflict | Manual intervention needed |
🧪 Conflict Resolution Example
Conflict Message:
pgsql
CopyEdit
<<<<<<< HEAD
driver.findElement(By.id(“user”)).sendKeys(“admin”);
=======
driver.findElement(By.id(“username”)).sendKeys(“lok”);
>>>>>>> login-test
✅ You decide the final version, then remove the conflict markers <<<<<<<, =======, >>>>>>>.
✅ Final Steps After Resolving Conflict
bash
CopyEdit
git add .
git commit -m “Resolved conflict in LoginTest.java”
git push origin main
🎯 Best Practices for QA Testers
Practice | Why It’s Important |
📂 One feature = one branch | Test cases stay organized |
🔄 Frequent pull from main | Conflict कम हुन्छ |
🧪 Test before merging | Prevents broken code |
📝 Clear commit messages | Code history readable हुन्छ |
📌 Summary
Git branching & merging ले team collaboration structured बनाउँछ।
Conflict आउँछ भने डराउनु पर्दैन — Git ले तपाईंलाई समाधान गर्ने guide दिन्छ।
🧠 “Branch often, commit smartly, and merge with care.”
🔹 Chapter 7: GitHub & GitLab for QA/Test Automation
QA र Test Automation को लागि GitHub र GitLab कसरी प्रयोग गर्ने? Practical Workflow
📖 Introduction
आजको QA मा test case version control मात्र होइन, automation, reporting, र CI/CD integration पनि अनिवार्य छ।
GitHub र GitLab दुवै platform ले testers लाई QA process streamline गर्न सहयोग गर्छन् — from test script storage to auto-run in pipelines.
🤖 Test code मात्र होइन, GitHub र GitLab मा test run पनि smart तरीकाले manage गर्न सकिन्छ।
🧪 Why QA Teams Should Use GitHub or GitLab
Benefit | Explanation |
📁 Central test case repository | Selenium, Postman, JMeter files version-controlled |
🤝 Team collaboration | Code review via Pull/Merge requests |
⚙️ CI/CD pipeline integration | Auto-run tests on every push |
📊 Test reports archive | Logs + screenshots + results traceable |
🔒 Permission control | Who can change/run what is managed |
🛠️ Real QA Automation Workflow with GitHub
Example: Selenium Test + GitHub + GitHub Actions
- QA pushes LoginTest.java to GitHub
- GitHub Actions triggers on push event
- Maven test runs inside Ubuntu runner
- Results logged or deployed as report
GitHub Actions Sample Workflow:
yaml
CopyEdit
name: Run Selenium Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
– uses: actions/checkout@v2
– name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ’17’
– name: Run tests
run: mvn test
🛠️ Real QA Automation Workflow with GitLab
Example: Postman Test + GitLab CI/CD
- QA commits Postman collection .json
- GitLab CI pipeline runs Newman (CLI runner)
- Test result is shown in job logs or JUnit report
GitLab .gitlab-ci.yml Sample:
yaml
CopyEdit
stages:
– test
qa_test:
stage: test
image: postman/newman
script:
– newman run Tests/postman_collection.json
🔍 When to Use Which (GitHub vs GitLab for QA)
Scenario | Use GitHub | Use GitLab |
Simple automation with GitHub Actions | ✅ | |
Built-in test dashboard, runner control | ✅ | |
Open-source QA project sharing | ✅ | ✅ |
On-prem QA infrastructure | ✅ |
🎯 Best Practices for Testers
- Use meaningful commit messages: “✅ Added invalid login test scenario”
- Always branch for each feature/test module
- Automate reports with Allure/TestNG + CI
- Store test data, reports, and logs in structured folders
📌 Conclusion: GitHub र GitLab केवल developer को लागि होइन — यो modern QA को foundation पनि हो। Automation, reporting, history, र integration सबै Git platform बाट सुरू हुन्छ।
🔹 Chapter 8: Common Git Errors & Fixes (Nepali-English Troubleshooting)
Git प्रयोग गर्दा आउने सामान्य समस्याहरू र सजिलो समाधानहरू (QA Tester’s Guide)
📖 Introduction
Git powerful छ, तर गल्ती हुँदा tester हरू अल्मलिन्छन्।
यस chapter मा हामी सबैभन्दा common Git error हरू को Nepali-English समाधान देख्नेछौँ — ताकि तपाईंको QA workflow रोकिएको नहोस्।
🛠️ “Don’t fear Git errors — fix them like a pro.”
❗ 1. fatal: not a git repository (or any of the parent directories)
Error Meaning: तपाईंले Git command चलाउनुभएको folder मा Git repo initialized छैन।
✅ Fix:
bash
CopyEdit
git init
या confirm गर्नुहोस् कि तपाईंले सही repo folder मा हुनुहुन्छ।
❗ 2. error: failed to push some refs to [URL]
Error Meaning: तपाईंको local र remote branch mismatch भयो।
✅ Fix:
bash
CopyEdit
git pull origin main –rebase
# अनि
git push origin main
❗ 3. Merge Conflict Detected
Error Meaning: दुई जनाले एउटै line मा edit गरे — Git ले decide गर्न सकेन।
✅ Fix:
- VS Code ले conflict देखाउँछ
- Conflict resolve गरेर conflict marker हटाउनुहोस् (<<<<<<<, =======, >>>>>>>)
- अनि:
bash
CopyEdit
git add .
git commit -m “✅ Conflict resolved”
git push
❗ 4. Permission Denied (publickey)
Error Meaning: GitHub सँग तपाईंको SSH key linked छैन।
✅ Fix:
- Generate SSH key:
bash
CopyEdit
ssh-keygen -t ed25519 -C “youremail@example.com”
- GitHub मा add गर्नुहोस् (Settings → SSH Keys)
❗ 5. detached HEAD state
Error Meaning: तपाईं commit मा checkout गर्नुभएको छ — कुनै branch होइन।
✅ Fix:
bash
CopyEdit
git checkout main
या
bash
CopyEdit
git switch -c new-branch
🧪 QA Tester Tips for Error Handling
Tip | Benefit |
🔄 Always pull before push | Prevent conflict |
🧪 Work in branches | Minimize merge issues |
💬 Write clear commit messages | Easy to identify source of bugs |
📁 Use .gitignore wisely | Avoid pushing sensitive or log files |
📓 Maintain a Git Troubleshooting Sheet | Save time and avoid panic |
📌 Summary
Git errors normal छन्। तर तपाईंले यी fixes जान्नुभयो भने testing वा coding रोकिदैन।
Confident QA tester बन्न Git commands + fixes दुवै आउन जरुरी हुन्छ।
🧠 Practice, fail, fix — that’s how you Git better.
🔹 Git Command Guide – With Real-World QA Use Cases
1️⃣ git init
Purpose: नया Git repository सुरु गर्ने
🔹 Real Use: तपाईंले Selenium test framework तयार पार्नुभयो — Git ले version control सुरु गर्न:
bash
CopyEdit
git init
➡️ अब .git folder बनिन्छ, जसले commit history track गर्न सुरु गर्छ।
2️⃣ git clone
Purpose: Remote repo लाई local मा ल्याउने
🔹 Real Use: QA lead ले GitHub मा regression framework राखेका छन् — तपाईंले clone गर्नुपर्छ:
bash
CopyEdit
git clone https://github.com/org/project.git
➡️ Project को सबै file तपाईंको system मा आउँछ।
3️⃣ git status
Purpose: कुन file modified, staged, या untracked छ भन्ने हेर्न
🔹 Real Use: Test case लेखेपछि हेर्नुपर्छ कि Git ले त्यो track गर्यो कि होइन:
bash
CopyEdit
git status
➡️ Red मा modified/untracked files देखिन्छ।
4️⃣ git add
Purpose: File लाई staging मा राख्ने (commit गर्न तयार)
🔹 Real Use: LoginTest.java मा test case add गरेपछि:
bash
CopyEdit
git add LoginTest.java
# या सबै file:
git add .
➡️ अब commit गर्न तयार भयो।
5️⃣ git commit
Purpose: Staged change लाई Git मा save गर्ने (with message)
🔹 Real Use: Test case को meaning स्पष्ट गर्न message सहित:
bash
CopyEdit
git commit -m “✅ Added negative login test case”
➡️ अब Git ले तपाईंको change को snapshot राख्यो।
6️⃣ git push
Purpose: Local commit लाई remote (GitHub, GitLab) मा पठाउने
🔹 Real Use: Team members लाई तपाईंको test देखाउन:
bash
CopyEdit
git push origin main
➡️ GitHub मा code देखिन्छ।
7️⃣ git pull
Purpose: GitHub बाट नया code ल्याउने (before pushing your own)
🔹 Real Use: Teammate ले test fix गरे, तपाईंले त्यो pull गर्नुपर्छ:
bash
CopyEdit
git pull origin main
➡️ Merge conflict आउन नदिन अत्यन्त जरूरी।
8️⃣ git branch
Purpose: कुन-कुन branch छन् भनेर हेर्न
🔹 Real Use: main, feature/login-test, आदि कति छन् भनेर जान्न:
bash
CopyEdit
git branch
➡️ Asterisk (*) ले current branch देखाउँछ।
9️⃣ git checkout -b branchname
Purpose: नयाँ branch बनाउने र switch गर्ने
🔹 Real Use: हर test module को लागि अलग branch चाहिन्छ:
bash
CopyEdit
git checkout -b add-payment-test
➡️ अब तपाईं अलग environment मा काम गर्न सक्नुहुन्छ।
🔟 git merge
Purpose: अर्को branch को काम main मा ल्याउने
🔹 Real Use: QA ले payment-test सकिसकेपछि merge गर्नुहोस्:
bash
CopyEdit
git checkout main
git merge add-payment-test
➡️ सबै test अब main framework मा जोडिन्छ।
1️⃣1️⃣ git log
Purpose: Commit history हेर्न
🔹 Real Use: Tester ले देख्नुपर्यो कि last test case commit कहिले भयो:
bash
CopyEdit
git log
➡️ Commit ID, author, date, message देखिन्छ।
1️⃣2️⃣ git diff
Purpose: File मा के फरक छ हेर्न
🔹 Real Use: दुई commit बीचको फरक हेर्न:
bash
CopyEdit
git diff HEAD
➡️ Highlights modified lines.
1️⃣3️⃣ git reset
Purpose: Stage बाट file हटाउने (commit नगरी rollback)
🔹 Real Use: गल्तीले add गरियो भने:
bash
CopyEdit
git reset LoginTest.java
➡️ File फेरि unstaged हुन्छ।
1️⃣4️⃣ git rm
Purpose: File delete गरी Git history मा राख्ने
🔹 Real Use: पुरानो script हटाउनु छ:
bash
CopyEdit
git rm OldTestCase.java
➡️ Commit पछि, यो file remove हुने Git मा।
1️⃣5️⃣ git revert
Purpose: पुरानो commit को effect undo गर्ने
🔹 Real Use: खराब merge पछि test case rollback:
bash
CopyEdit
git revert <commit-id>
➡️ पुरानो code safe restore हुन्छ।
🧠 Real-Life QA Use Case Summary
Git Action | QA Use |
clone, checkout, pull | Regression framework setup गर्नु |
add, commit, push | Test case update version control गर्नु |
branch, merge | Parallel module test काम गर्न |
status, diff, log | QA lead लाई track/report गर्न |
revert, reset, rm | गल्ती सुधार्ने या पुरानो test हटाउने |
🔹 What is git fetch?
Git fetch भनेको GitHub (वा remote) मा भएको नयाँ change लाई local मा download मात्र गर्ने process हो — merge नगरी।
📖 Explanation in Simple Terms
- git fetch ले remote repository मा भएको नयाँ commits वा branches लाई download मात्र गर्छ।
- Fetch पछि तपाईंले decide गर्नुहुन्छ कि merge गर्ने कि होइन।
🧠 “Pull भनेको fetch + merge हो, fetch भनेको केवल information ल्याउने command हो।”
🧪 Real-Life QA Example
Imagine तपाईंको teammate ले नयाँ branch बनायो feature/signup-test. तपाईंले त्यो update देख्न चाहनुहुन्छ:
bash
CopyEdit
git fetch origin
Now, you can run:
bash
CopyEdit
git checkout feature/signup-test
➡️ तपाईंले त्यो branch हेर्न, review गर्न सक्नुहुन्छ — merge बिना।
🔄 Comparison: git fetch vs git pull
Feature | git fetch | git pull |
🔽 What it does | Remote change लाई download मात्र गर्छ | Download + Merge दुबै गर्छ |
💥 Merge conflict? | हुँदैन | हुन सक्छ |
🧪 QA use case | Code review गर्न या safely inspect गर्न | जब नयाँ code merge गर्न चाहिन्छ |
🔍 Control level | High (manual merge) | Low (auto merge if conflict छैन भने) |
✅ Best Practice for QA/Testers
Use this flow when working in real projects:
bash
CopyEdit
git fetch origin
git status
git log origin/main
# Then if all looks good
git merge origin/main
➡️ This gives you control, especially in production or release branches.