Remote Repository၊ Fetch၊ Pull နဲ့ Push
Remote ဆိုတာ ချိတ်ဆက်ထားတဲ့ repository လိပ်စာကို နာမည်တပ်ပြီး မှတ်ထားတာပါ။ အဲဒီကနေ commit တွေ ယူတာနဲ့ ပို့တာ သိလာရင် GitHub မှာ ဒီ Project ကိုပဲ ဆက်ပြီး ပူးပေါင်း လုပ်ဆောင်နိုင်ပါတယ်။
ဒီစာမျက်နှာမှာ
ရှိပြီးသား Repository ကို Clone လုပ်ခြင်း
Local copy အသစ်လိုရင် Project ရဲ့ အပြင်ဘက် folder ဒါမှမဟုတ် တခြား workspace မှာ clone လုပ်ပါ။ Git က repository history ကို ကူးပြီး remote ကို ပုံမှန်အားဖြင့် origin လို့ နာမည်ပေးပါတယ်။ OWNER နေရာမှာ account ဒါမှမဟုတ် organization နာမည် ထည့်ပြီး URL အစစ်ကို သုံးပါ။
git clone https://github.com/OWNER/project-notes.git
cd project-notes
git remote -v
Remote Changes ကို မပေါင်းခင် ကြည့်ခြင်း
origin/main ကို ချိတ်ထားတဲ့ repository မှာ git fetch origin က remote branch တွေအတွက် ကိုယ့်စက်ထဲက မှတ်တမ်းကို update လုပ်ပေးပါတယ်။ လက်ရှိ branch ထဲ merge မလုပ်သေးတဲ့အတွက် main နဲ့ origin/main ကို အရင် ယှဉ်ကြည့်နိုင်ပါတယ်။ main မှာ working tree ရှင်းနေရင် git pull --ff-only က fetch လုပ်ပြီး တိုက်ရိုက်ရှေ့ဆက်လို့ရတဲ့အခါ main ကို update လုပ်ပါတယ်။ နှစ်ဖက်လုံးမှာ ကိုယ်စီ commit အသစ်တွေ ရှိနေရင် History ကို အရင်စစ်ပါ။
git switch main
git fetch origin
git log --oneline main..origin/main
git pull --ff-only
Feature Branch က Commit တွေ မျှဝေခြင်း
Remote repository ကို write access ရှိရင် feature branch ဆောက်ပြီး origin ဆီ push လုပ်ပါ။ -u က Local branch နဲ့ remote branch ဆက်စပ်မှုကို မှတ်ထားပေးလို့ နောက်တစ်ခါ git push လို့ပဲ ရိုက်နိုင်ပါတယ်။ Branch အတွက် Pull Request ဖွင့်ပုံကို GitHub သင်ခန်းစာမှာ ဆက်ကြည့်ပါ။
git switch -c update-notes
git push -u origin update-notes