Git/Gitlab/Github

Mastering Git, GitHub, and GitLab – Version Control from Basics to DevOps”


📚 Chapter Breakdown Plan:

ChapterTitle
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/backupManuallyAutomatically version track हुन्छ
✅ Team collaborationConflicts आउँछMerge/branch system ले manage गर्छ
✅ Mistake undoHard to recoverEasy rollback with commit ID
✅ Deployment-ready codeDifficult to trackStable branches maintain गर्न सकिन्छ

🛠️ Git ले के गर्छ?

  1. Local Repo बनाउँछ – तपाईंको computer भित्र code को version राख्छ।
  2. Changes track गर्छ – कुन file कहिले change भयो भनेर Git ले याद राख्छ।
  3. History देखाउँछ – तपाईंले गरेको पुराना कामहरू log मार्फत हेर्न सक्नुहुन्छ।
  4. 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

TermMeaning
git initनया Git repo सुरु गर्ने command
git addfile लाई staging मा राख्ने
git commitsaved change history बनाउने
git pushGitHub मा code पठाउने
git pullGitHub बाट नया 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

CommandPurpose
git logCommit history हेर्न
git branchकुन branch मा छ भनेर थाहा पाउन
git checkout -b nameनया branch बनाउन

📌 Real-Life Use Case (QA Example)

  1. Clone automation framework from GitHub
  2. Add new test case in LoginTest.java
  3. Use git add, git commit, and git push
  4. 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

FeaturePurpose
📁 Repository HostingGit project लाई cloud मा सुरक्षित राख्ने
👨‍👩‍👧‍👦 CollaborationMultiple testers/devs एउटै repo मा काम गर्न सक्ने
🔁 Pull RequestsCode review र merge process handle गर्न
🧪 Issues & LabelsBug/feature discussion track गर्न
🤖 GitHub ActionsCI/CD automation चलाउन (test, deploy, etc.)

🧪 Example Workflow (QA Team)

  1. QA Engineer fork गर्छ main repo
  2. Code/test case लेखेर push गर्छ
  3. Pull request create गर्छ
  4. Team member ले review गर्छ
  5. 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

AdvantageImpact
📚 Centralized QA Codeसबै test case Git मा organize हुन्छ
👥 Team-based Reviewहर commit लाई verify गर्न सकिन्छ
🤝 Collaboration BoostManual + Automation testers सँग सहकार्य सजिलो
🔄 Integration ReadyJenkins, 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

FeatureGitHubGitLab
🏢 OwnerMicrosoftGitLab Inc. (Open core)
💻 Code HostingYes (Git)Yes (Git)
🤝 CollaborationPull Request systemMerge Request system
🤖 CI/CDGitHub ActionsBuilt-in CI/CD pipelines
🔒 Private Repo (Free)✅ Yes (Unlimited)✅ Yes (Unlimited)
🛠️ DevOps ToolsThird-party integration mostlyEverything built-in (Dev → Deploy)
📊 Project AnalyticsLimited (advanced via Pro)Advanced analytics + test report
🌐 Self-hosting Option❌ Cloud only✅ Yes (cloud & self-managed)
👥 Target UsersOpen-source + enterprise dev teamsDevOps teams needing end-to-end control

🎯 Use Cases Based on QA Needs

ScenarioRecommended Tool
✅ Open-source collaborationGitHub
✅ Large DevOps automation setupGitLab
✅ Simpler UI for beginner testersGitHub
✅ On-premise requirementGitLab
✅ Built-in test dashboard neededGitLab

🧪 QA Perspective

TaskGitHubGitLab
🧪 Trigger test on commitGitHub ActionsGitLab CI/CD (built-in)
📄 Test report summaryManual integration or 3rd partyNative HTML + JUnit + Coverage reports
🧠 Security testingAdd-on or marketplaceBuilt-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 CodeTerminal

💡 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

TaskGit 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)

  1. Switch to main branch:

bash

CopyEdit

git checkout main

  1. Merge changes:

bash

CopyEdit

git merge login-test

✅ अब login-test को सबै commits main मा मिसिन्छ।


⚠️ Conflict Explained (When Two Branches Edit Same Line)

ConditionResult
Same file edited by two branchesGit can’t auto-decide
Merge attempt triggers ⚠️ conflictManual 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

PracticeWhy It’s Important
📂 One feature = one branchTest cases stay organized
🔄 Frequent pull from mainConflict कम हुन्छ
🧪 Test before mergingPrevents broken code
📝 Clear commit messagesCode 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

BenefitExplanation
📁 Central test case repositorySelenium, Postman, JMeter files version-controlled
🤝 Team collaborationCode review via Pull/Merge requests
⚙️ CI/CD pipeline integrationAuto-run tests on every push
📊 Test reports archiveLogs + screenshots + results traceable
🔒 Permission controlWho can change/run what is managed

🛠️ Real QA Automation Workflow with GitHub

Example: Selenium Test + GitHub + GitHub Actions

  1. QA pushes LoginTest.java to GitHub
  2. GitHub Actions triggers on push event
  3. Maven test runs inside Ubuntu runner
  4. 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

  1. QA commits Postman collection .json
  2. GitLab CI pipeline runs Newman (CLI runner)
  3. 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)

ScenarioUse GitHubUse 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:

  1. VS Code ले conflict देखाउँछ
  2. Conflict resolve गरेर conflict marker हटाउनुहोस् (<<<<<<<, =======, >>>>>>>)
  3. अनि:

bash

CopyEdit

git add .

git commit -m “✅ Conflict resolved”

git push


❗ 4. Permission Denied (publickey)

Error Meaning: GitHub सँग तपाईंको SSH key linked छैन।

Fix:

  1. Generate SSH key:

bash

CopyEdit

ssh-keygen -t ed25519 -C “youremail@example.com”

  1. 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

TipBenefit
🔄 Always pull before pushPrevent conflict
🧪 Work in branchesMinimize merge issues
💬 Write clear commit messagesEasy to identify source of bugs
📁 Use .gitignore wiselyAvoid pushing sensitive or log files
📓 Maintain a Git Troubleshooting SheetSave 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 ActionQA Use
clone, checkout, pullRegression framework setup गर्नु
add, commit, pushTest case update version control गर्नु
branch, mergeParallel module test काम गर्न
status, diff, logQA 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

Featuregit fetchgit pull
🔽 What it doesRemote change लाई download मात्र गर्छDownload + Merge दुबै गर्छ
💥 Merge conflict?हुँदैनहुन सक्छ
🧪 QA use caseCode review गर्न या safely inspect गर्नजब नयाँ code merge गर्न चाहिन्छ
🔍 Control levelHigh (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.

Scroll to Top