Git နှင့် GitHub Workflow စတင်တည်ဆောက်နည်း
Repository စတင်ခြင်းမှ feature branch၊ review လွယ်သော commit နှင့် pull request workflow အထိ team project တစ်ခုလို စနစ်တကျလုပ်ပါမယ်။
ဖြေရှင်းမည့်ပြဿနာ
File များကို manual copy လုပ်ခြင်း သို့မဟုတ် main branch ပေါ်တိုက်ရိုက်ပြင်ခြင်းက code ပျောက်ခြင်း၊ conflict နှင့် review မလုပ်နိုင်ခြင်းကို ဖြစ်စေပါတယ်။
လိုအပ်ချက်များ
- Git ထည့်သွင်းထားသော computer
- GitHub account
- စမ်းသပ်မည့် project folder
Repository နှင့် ignore rules ပြင်ဆင်ပါ
Project root မှာ repository စတင်ပြီး generated files၊ dependencies နဲ့ secrets တွေကို .gitignore ထဲထည့်ပါ။ ပထမ commit က project စတင်အနေအထားကိုရှင်းလင်းစွာပြသင့်ပါတယ်။
$ git init
$ git status
$ git add .
$ git commit -m "Initial project setup"အလုပ်တစ်ခုစီကို branch ခွဲပါ
Feature၊ bug fix သို့မဟုတ် content update တစ်ခုစီကို branch အသစ်နဲ့လုပ်ပါ။ Branch name ကိုတိုတိုနဲ့ရည်ရွယ်ချက်သိသာအောင်ပေးပါ။
$ git switch -c feature/search-page
$ git add apps/web
$ git commit -m "Add tutorial search page"Review လွယ်သော commit လုပ်ပါ
Commit တစ်ခုမှာ ရည်ရွယ်ချက်တစ်ခုသာပါစေ။ Formatting ပြောင်းခြင်းနဲ့ feature logic ကို commit တစ်ခုထဲမရောပါနဲ့။ Commit မလုပ်မီ diff ကိုဖတ်ပြီး မလိုအပ်တဲ့ file နဲ့ secret မပါကြောင်းစစ်ပါ။
$ git diff
$ git diff --staged
$ git statusPull request ဖြင့် merge ပါ
Branch ကို push ပြီး pull request ဖွင့်ပါ။ ဘာပြောင်းထားတယ်၊ ဘယ်လိုစမ်းထားတယ်နှင့် screenshot လိုအပ်ရင် ထည့်ပါ။ Automated checks အောင်မြင်ပြီး review ပြီးမှ main ထဲ merge လုပ်ပါ။
ရရှိမည့်ရလဒ်
ပြောင်းလဲမှုတိုင်း history ရှိပြီး review၊ rollback နှင့် team collaboration လုပ်နိုင်သော GitHub workflow တစ်ခု ရရှိပါမယ်။
အဆင်မပြေပါက စစ်ဆေးရန်
- Merge conflict ဖြစ်လျှင် main ကို pull/rebase လုပ်ပြီး conflict marker များကိုလက်ဖြင့်ဖြေရှင်းပါ။
- မမှန်သော file commit ဝင်လျှင် ဖျက်ခြင်းမပြုမီ git status နှင့် history ကိုစစ်ပါ။
- Authentication မအောင်မြင်လျှင် GitHub CLI သို့မဟုတ် SSH key configuration ကိုစစ်ပါ။