Thuta Learning
Git & GitHub: Collaboration and Professional Workflows
BasicDevOps & Toolsintermediate

Git နှင့် GitHub

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

  • Git နှင့် GitHub concept ကို နားလည်ရှင်းပြနိုင်ရန်
  • Diagram ကို ဖတ်ပြီး Git/GitHub workflow ထဲမှာ state (သို့) data ဘယ်လိုစီးဆင်းသလဲ ခြေရာခံနိုင်ရန်
  • ကိုယ့် project/team အတွက် ဘယ်လို အသုံးချသင့်သလဲ ဆုံးဖြတ်နိုင်ရန်

နားလည်ထားရမယ့် အချက်

Git နှင့် GitHub ဆိုတာ အသံထွက်တူသလို ခံစားရပေမယ့် ဖြေရှင်းပေးတဲ့ ပြဿနာက လုံးဝကွာခြားပါတယ်။ Git ဆိုတာ သင့်ကွန်ပျူတာပေါ်မှာ လုံးဝ run လုပ်နိုင်တဲ့ version control tool တစ်ခုဖြစ်ပြီး — Git tutorial မှာ သင်သုံးခဲ့တဲ့ git init၊ git add၊ git commit၊ git branch၊ git merge command တွေအားလုံးက အင်တာနက်လိုအပ်ချက် လုံးဝမရှိဘဲ ပြီးပြည့်စုံစွာ အလုပ်လုပ်ပါတယ်။

GitHub ကတော့ ကုမ္ပဏီတစ်ခုရဲ့ product ပါ — Git ပေါ်မှာ တည်ဆောက်ထားတဲ့ website နှင့် server အစုအဝေးတစ်ခုဖြစ်ပြီး သင့် repository တွေကို cloud ပေါ်မှာ host လုပ်ပေးတာအပြင် Git ကိုယ်တိုင် ဘာမှ သိမထားတဲ့ collaboration layer တစ်ခုလုံးကို ထပ်ဖြည့်ပေးပါတယ်။

  • Pull request များနှင့် code review
  • Issue tracking
  • Automation အတွက် GitHub Actions
  • Software ထုတ်ဝေရန် release

Git ကို အသုံးဝင်ဖို့ GitHub လိုအပ်တာ လုံးဝမဟုတ်ပါဘူး။ Laptop တစ်လုံးပေါ်မှာ တစ်ယောက်တည်း အလုပ်လုပ်နေရင်း ဘယ်တော့မှ push မလုပ်ဘဲနေနိုင်ပြီး Git က commit တိုင်းကို ပြီးပြည့်စုံစွာ မှတ်တမ်းတင်ပေးပါလိမ့်မယ်။ လူတစ်ယောက်ထက်ပိုပြီး codebase တစ်ခုတည်းပေါ်မှာ အလုပ်လုပ်ဖို့ လိုလာတဲ့အခါမှသာ GitHub က တန်ဖိုးရှိလာပါတယ်။

GitHub အပြင် ရွေးချယ်စရာများ

GitHub တစ်ခုတည်းသာ ရွေးစရာ မဟုတ်ပါဘူး — GitLab နှင့် Bitbucket တို့ဟာ ဆင်တူတဲ့ hosting-plus-collaboration model ကို ပေးနေတဲ့ တိုက်ရိုက်ပြိုင်ဖက်တွေဖြစ်ပြီး၊ ကုမ္ပဏီအများအပြားက ကိုယ်ပိုင် private Git server တွေကိုပါ run လုပ်ကြပါတယ်။

GitHub ကို အခြားရွေးချယ်စရာတွေအစား ရွေးတာဟာ hosting ဆိုင်ရာ ဆုံးဖြတ်ချက်တစ်ခုသာဖြစ်ပြီး Git ဆိုင်ရာ ဆုံးဖြတ်ချက် မဟုတ်ပါဘူး — အခြေခံ version control command တွေက ဘယ် server ကို push လုပ်လုပ် အတူတူပါပဲ။ ဒီသင်ခန်းစာက တံတားပါ — ဒီနေရာကနေစပြီး local Git ကို ကျွမ်းကျင်နေပြီဆိုတဲ့ သဘောထားနှင့် platform layer ကို ဆက်ထည့်ဖို့ အသင့်ဖြစ်နေပြီလို့ ယူဆထားပါတယ်။

Git
ဖိုင်များ၏ ပြောင်းလဲမှုများကို အချိန်နှင့်အမျှ သင့်ကွန်ပျူတာပေါ်မှာ လုံးဝ track လုပ်ပေးတဲ့ အခမဲ့ open-source tool တစ်ခုဖြစ်ပြီး server လုံးဝ မလိုအပ်ပါ။
GitHub
Git repository များကို cloud ပေါ်မှာ host လုပ်ပေးပြီး pull request၊ issue၊ Actions လို collaboration tool များကို Git အပေါ်မှာ ထပ်ဖြည့်ပေးတဲ့ ကုမ္ပဏီနှင့် website တစ်ခုဖြစ်ပါတယ်။
Version Control
ဖိုင်များ၏ ပြောင်းလဲမှုများကို အချိန်နှင့်အမျှ မှတ်တမ်းတင်ပေးတဲ့ စနစ်တစ်ခုဖြစ်ပြီး history ကို ပြန်ကြည့်နိုင်တာ၊ version အချင်းချင်း နှိုင်းယှဉ်နိုင်တာ၊ လိုအပ်ရင် ယခင်အခြေအနေသို့ ပြန်ရောက်နိုင်တာတွေ လုပ်ဆောင်ပေးပါတယ်။
text
GIT VS GITHUB
-------------
YOUR COMPUTER (local)          GITHUB.COM (hosted platform)
---------------------          -----------------------------
Git: init, add, commit         Repository hosting
     branch, merge, log        + Pull Requests + Issues
                                + Actions (CI/CD) + Releases

        |---------- push ----------------------->|
        |<--------- fetch / pull -----------------|

Git works alone. GitHub is a platform built ON TOP of Git.

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

ရှေ့ဆက်မတိုင်ခင်၊ Git tutorial က ချန်ထားခဲ့တဲ့အတိုင်း သင့် local setup က ဆက်လက်အလုပ်လုပ်နေဆဲလား စစ်ဆေးလိုက်ပါ။

Git version စစ်ပါ

git --version ကို run ပါ — GitHub ရဲ့ feature အသစ်တချို့က version အနည်းငယ်သစ်တာ လိုအပ်တတ်ပါတယ်။

Identity စစ်ပါ

git config --get user.name နှင့် git config --get user.email ကို စစ်ပါ — ဒါတွေက commit တိုင်းပေါ်မှာ Git က ထုတ်ပေးတဲ့ identity ဖြစ်ပါတယ်။ ဘာမှ print မလုပ်ရင် git config --global နဲ့ ပြန်သတ်မှတ်ပါ။

Remote link ကြည့်ပါ

git remote -v က သင့် local folder နှင့် GitHub hosted copy ကြားက link ကို ပြပါတယ် — .git နဲ့ ဆုံးတဲ့ URL တစ်ခုပါ။

ဒီ line တစ်ကြောင်းတည်းက သင်သိပြီးသား local Git နှင့် ဒီ tutorial က ဖွင့်ပေးတော့မယ့် GitHub platform ကြားက တံတားတစ်ခုလုံးပါပဲ။ သင့် local workflow ဘာမှ ပြောင်းမသွားပါဘူး — GitHub က ဒီ remote ကို တခြားလူတွေပါ ရောက်နိုင်တဲ့ နေအိမ်တစ်ခု ပေးလိုက်ရုံပါပဲ။

အတူတူ စမ်းရေးကြည့်မယ်

bash
git --version
git config --get user.name
git config --get user.email
git remote -v
git remote add origin https://github.com/yourname/example-repo.git
git remote -v
You should see
git --version -> git version 2.53.0.windows.2 (သင့်စက်ပေါ်မှာ version အနည်းငယ် ကွာနိုင်ပါတယ်)
git config --get user.name -> Thuta Learner
git config --get user.email -> learner@example.com
git remote -v (remote မထည့်ခင်) -> ဘာမှ print မလုပ်ပါ
git remote add origin ... ပြီးနောက် git remote -v ->
origin  https://github.com/yourname/example-repo.git (fetch)
origin  https://github.com/yourname/example-repo.git (push)

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

GitHub ကနေ clone လုပ်ထားတဲ့ project တစ်ခုအစစ်ထဲမှာ git remote -v ကို run ပြီး URL က HTTPS လား SSH လားဆိုတာ ခွဲခြားကြည့်ပါ။ ပြီးရင် git config --get user.name နှင့် user.email ကို run ပြီး GitHub ပေါ်က သင့် commit တွေမှာ ပါစေချင်တဲ့ identity နှင့် ကိုက်ညီမှု ရှိမရှိ စစ်ဆေးပါ။

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

GitHub ကိုပဲ Git ဟု ထင်မှတ်ခြင်း — fork ဒါမှမဟုတ် pull request လို concept တွေကို Git ကိုယ်တိုင် နားလည်ထားတယ်လို့ ထင်တာမျိုး၊ တကယ်တော့ GitHub-specific concept တွေသာ ဖြစ်ကြောင်း

local မှာ git config user.name/user.email ကို သတ်မှတ်ဖို့ မေ့နေခြင်း — GitHub ပေါ် push လုပ်လိုက်ရင် commit တွေက generic ဒါမှမဟုတ် မှားယွင်းတဲ့ identity နဲ့ ချိတ်ဆက်ကုန်နိုင်ခြင်း

GitHub Docs: About GitGit & GitHub

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

  • GitHub ကိုပဲ Git ဟု ထင်မှတ်ခြင်း — fork ဒါမှမဟုတ် pull request လို concept တွေကို Git ကိုယ်တိုင် နားလည်ထားတယ်လို့ ထင်တာမျိုး၊ တကယ်တော့ GitHub-specific concept တွေသာ ဖြစ်ကြောင်း
  • local မှာ git config user.name/user.email ကို သတ်မှတ်ဖို့ မေ့နေခြင်း — GitHub ပေါ် push လုပ်လိုက်ရင် commit တွေက generic ဒါမှမဟုတ် မှားယွင်းတဲ့ identity နဲ့ ချိတ်ဆက်ကုန်နိုင်ခြင်း
  • Destructive (သို့) history ပြောင်းလဲနိုင်တဲ့ command တိုင်းကို run မခင် git status နဲ့ လက်ရှိအခြေအနေကို အမြဲစစ်ပါ။

လေ့ကျင့်ခန်း

GitHub ကနေ clone လုပ်ထားတဲ့ project တစ်ခုအစစ်ထဲမှာ git remote -v ကို run ပြီး URL က HTTPS လား SSH လားဆိုတာ ခွဲခြားကြည့်ပါ။ ပြီးရင် git config --get user.name နှင့် user.email ကို run ပြီး GitHub ပေါ်က သင့် commit တွေမှာ ပါစေချင်တဲ့ identity နှင့် ကိုက်ညီမှု ရှိမရှိ စစ်ဆေးပါ။

You'll know it worked when: git --version -> git version 2.53.0.windows.2 (သင့်စက်ပေါ်မှာ version အနည်းငယ် ကွာနိုင်ပါတယ်) git config --get user.name -> Thuta Learner git config --get user.email -> learner@example.com git remote -v (remote မထည့်ခင်) -> ဘာမှ print မလုပ်ပါ git remote add origin ... ပြီးနောက် git remote -v -> origin https://github.com/yourname/example-repo.git (fetch) origin https://github.com/yourname/example-repo.git (push)