ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
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 နမူနာ
# 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 mainGitHub 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 ရှုပ်ထွေးနိုင်ပါတယ်။