Thuta Learning
ရှာဖွေရန်
ProjectsDevOps & Toolsbeginner

Project: Portfolio Website — Part 2 (Feature Branch)

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Project: Portfolio Website — Part 2 (Feature Branch) ကို လက်တွေ့ project ထဲမှာ အသုံးချတတ်မယ်
  • ကိုယ်တိုင် code ရေးပြီး run ကြည့်တတ်မယ်
  • Project တစ်ခုလုံးကို အဆင့်လိုက် ဆောက်တတ်မယ်

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

Real-world development မှာ feature အသစ်တိုင်းကို main branch ပေါ်မှာ တိုက်ရိုက်မလုပ်ဘဲ, သီးခြား branch တစ်ခုပေါ်မှာ လုပ်လေ့ရှိပါတယ်။ ဒီအပိုင်းမှာ branch ဖန်တီးခြင်း, switch လုပ်ခြင်း, ပြီးမှ main ထဲ merge ပြန်ထည့်ခြင်းကို practice လုပ်ကြမယ်။ ထို့အပြင် ကျွန်တော်တို့ ရဲ့ local repository ကို GitHub ပေါ်က remote repository တစ်ခုနဲ့ ချိတ်ဆက်ပြီး push လုပ်တဲ့ workflow ကိုပါ လေ့လာကြမယ်။ ဒီအဆင့်ပြီးရင် project ရဲ့ history မှာ branch, merge, နှင့် remote sync တွေ ပါဝင်လာမှာ ဖြစ်ပါတယ်။

လက်တွေ့ ဆောက်ကြည့်မယ်

feature/projects-section ဆိုတဲ့ branch အသစ်တစ်ခု git branch ဖြင့် ဖန်တီးပြီး git switch ဖြင့် ပြောင်းပါ။ index.html ထဲမှာ Projects section (heading တစ်ခု နဲ့ project 2-3 ခု list) ထည့်ပြီး commit လုပ်ပါ။ main branch ကို switch ပြန်ပြောင်းပြီး git merge feature/projects-section ဖြင့် ပြန် merge ပါ။ နောက်ဆုံးမှာ GitHub ပေါ်မှာ empty repository တစ်ခု ဖန်တီးပြီး git remote add origin ဖြင့် ချိတ်ကာ git push -u origin main ဖြင့် push လုပ်ပါ။

Code နမူနာ

bash
# Step 1: feature branch ဖန်တီးပြီး switch လုပ်ပါ
git branch feature/projects-section
git switch feature/projects-section

# Step 2: index.html ကို edit လုပ်ပြီး (Projects section ထည့်ပါ) commit လုပ်ပါ
git add index.html
git commit -m "Add projects section to homepage"

# Step 3: main branch ကို ပြန်သွားပြီး merge လုပ်ပါ
git switch main
git merge feature/projects-section

# Step 4: feature branch ကို ပြီးရင် ဖျက်နိုင်ပါတယ် (optional)
git branch -d feature/projects-section

# Step 5: GitHub remote ချိတ်ဆက်ပြီး push လုပ်ပါ
git remote add origin https://github.com/<your-username>/portfolio-site.git
git push -u origin main
You should see
GitHub repository page ကို refresh လုပ်လိုက်ရင် Projects section ပါဝင်တဲ့ index.html နှင့် commit history အားလုံး ပေါ်လာမည်။

၅ မိနစ် စမ်းကြည့်

feature/about-section ဆိုတဲ့ branch အသစ်တစ်ခု ဖန်တီးပြီး About Me section တစ်ခု ထပ်ထည့်ကာ main ထဲ merge ပြန်ကျင့်ကြည့်ပါ (5 မိနစ်).

သတိလေးတစ်ချက်

merge မလုပ်ခင် git status ဖြင့် အခု ဘယ် branch ပေါ်မှာ ရှိနေလဲဆိုတာ အမြဲ double-check လုပ်ပါ — မှားတဲ့ branch ပေါ်မှာ merge လုပ်မိရင် history ရှုပ်ထွေးနိုင်ပါတယ်။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • feature branch ပေါ်မှာ ရှိနေတုန်း main ထဲ merge လုပ်ဖို့ မေ့ပြီး git switch main မလုပ်ဘဲ git merge command ကို feature branch ပေါ်ကနေပဲ run ခြင်း
  • git remote add origin ကို repository URL မှားပြီး run လိုက်တာကြောင့် push လုပ်တဲ့အခါ error တက်ခြင်း (git remote -v ဖြင့် အရင်စစ်သင့်သည်)

အခု ကိုယ်တိုင် စမ်းကြည့်

feature/about-section ဆိုတဲ့ branch အသစ်တစ်ခု ဖန်တီးပြီး About Me section တစ်ခု ထပ်ထည့်ကာ main ထဲ merge ပြန်ကျင့်ကြည့်ပါ (5 မိနစ်).

You'll know it worked when: GitHub repository page ကို refresh လုပ်လိုက်ရင် Projects section ပါဝင်တဲ့ index.html နှင့် commit history အားလုံး ပေါ်လာမည်။

Project: Portfolio Website — Part 2 (Feature Branch) | Thuta Learning