Skip to main content

Git - Version Control

Git - Version Control


About Version Control

Version Control ဆိုတာ System တစ်ခုပဲဖြစ်ပါတယ်။ Computer System ပေါမှာ Files ကို update လုပ်တဲ့အခါမှာ သူတို့ရဲ့ပြောင်းလဲမှုတွေကို အချိန်နဲ့ တစ်ပြေးညီ Versions တွေနဲ့ မှတ်တမ်းတင်ထားပေးခြင်းဖြစ်ပါတယ်။
လိုအပ်တဲ့ အချိန်မှာ သက်ဆိုင်ရာ version တွေမှာ ဘာတွေပြောင်းလဲခဲ့လဲ၊ ဘယ်အချိန်ပြောင်းလဲခဲ့လဲ ဆိုတာတွေကို ပြန်လည် ကြည့်နိုင်တယ်။ ပြီးတော့ ကိုယ်ကြိုက်တဲ့ Version တစ်ခုခု ကိုလဲ အချိန်မရွေး ပြန်ယူနိုင်ပါတယ်။ ဥပမာ - Programming အတွက်ဆိုရင်တော့ Source Code files တွေကို Version Control လုပ်ပြီးအသုံးပြုကြပါတယ်။ Source Code file တွေမှမဟုတ်ပဲ၊ ဘယ် File အမျိုးအစားကို မဆို Version Control နဲ့ အသုံးပြုနိုင်ပါတယ်။ ဥပမာ - ဓာတ်ပုံ၊ ဗွီဒီရို၊ Excel file, Word file and etc.Version Control Systems တွေကတော့ အောက်ပါအတိုင်း သုံးမျိုးရှိပါတယ်။ 
  1. Local Version Control Systems
  2. Centralized Version Control Systems
  3. Distributed Version Control System

1. Local Version Control Systems


အများစုက Local Version Control Systems အနေနဲ့ File တွေကို copy ကူးပြီး၊ တခြားတစ်နေရာရာ မှာ သိမ်းထားလေ့ရှိကြပါတယ်။ Folder တွေဆောက်ပြီး Date time ၊ မှတ်ချက် အနည်းငယ်ကို folder name မှာထားပြီး copy အနေနဲ့ သိမ်းထားလေ့ရှိကြပါတယ်။ ဒီလိုသိမ်းတာက အခြေခံအားဖြင့်တော့ လွယ်ကူပြီးတော့၊ အဆင်ပြေပါတယ်။ ဒါပေမဲ့ များလာတာနဲ့အမျှ ပြသနာတွေရှိလာပါတယ်။ ဥပမာ - မှားဖျက်မိတာ၊ မှားပြင်မိတာ တို့ လုပ်မိတတ်ပါတယ်။
အရင်က ဒီပြသနာတွေကို ဖြေရှင်းဖို့အတွက် programer တွေက database ကိုအသုံးပြုပြီး Version Control System (VCS) တစ်ခုလုပ်ခဲ့ကြပါတယ်။ VCS ကိုသုံးပြီး file တွေရဲ့ changes တွေကို Version တွေအလိုက်သိမ်း ပြီး အသုံးပြုတယ်။ 

2. Centralized Version Control Systems


Local Version Control System ကိုအသုံးပြုနေရင်း နောက်ထပ် ပြသနာတစ်ခုက Developer တွေက code ရေးတဲ့အခါ တစ်ယောက်ထဲ ထက် Team နဲ့ရေးတော့ Version Control တွေကို Team တစ်ခုလုံး ပေါင်းသုံးလို့မရဘူး။ အဲ့အတွက်ကြောင့် Developer တွေက Centralized Version Control Systems (CVCS) တွေကို develop လုပ်ခဲ့ကြတယ်။ အဲ့ဒါတွေကတော့ CVS, Subversion, and Perforce တို့ဖြစ်ကြတယ်။ CVCS  တွေက Version Control ကို server တစ်ခုထဲမှာ ပဲ အားလုံးသိမ်းပြီး အလုပ်လုပ်တယ်။ Developer/ Client တွေက central server ကနေပဲ checkout လုပ်ပြီးအသုံးပြုတယ်။ နှစ်အတော်ကြာကြာ CVCS ကို Standard Version Control အဖြစ်နဲ့ အသုံးပြုခဲ့ကြတယ်။
CVCS ရဲ့အဓိက အားနည်းချက်ကတော့ Centralized ဖြစ်တဲ့ အတွက်ကြောင့် Server မှာ တစ်ခုခုပြသနာတက်တာနဲ့  ဘယ်သူမှသုံးလို့မရတော့ဘူး။ Server down နေတဲ့ အချိန်မှာဆို ဘယ်သူမှ commit လုပ်မရဘူး၊ history တွေလဲ ကြည့်မရဘူး၊ checkout လဲဆွဲမရဘူး၊ အားလုံး ရပ်ဆိုင်းထားရတော့မှာဖြစ်တယ်။ နောက်တစ်ခုကတော့ Server မှာ Version တွေကို မှတ်ထားတဲ့ File/ Database က ပျက်သွားတယ်ဆိုရင်တော့၊​ ရှိသမျှ history တွေ အကုန်လုံးဆုံးရှုံး သွားမှာပါ။

3. Distributed Version Control Systems


အဲ့လိုနဲ့ အဆင့်ဆင့် လုပ်ပြုပြင်ပြောင်းလဲ လာကြရင် Distributed Version Control Systems (DVCS) ဖြစ်လာခဲ့တယ်။ ပေါ်ပြူလာဖြစ်တဲ့ DVCS တွေကတော့ - Git, Mercurial, Bazzar and Darcs တို့ ဖြစ်ကြတယ်။ DVCS မှာ client က file တွေကိုရဲ့ နောက်ဆုံး version ကိုပဲ ရယူထားတာမဟုတ်ပဲ၊ server တစ်ခုလုံးရဲ့ history အားလုံးနဲ့အတူတူ Full Mirror အနေနဲ့ ယူထားတယ်။ အဲ့ဒါကြောင့် Server မှာတစ်ခုခု ပြသနာရှိနေလို့၊ ဒါမှမဟုတ် လုံးဝပျက်ဆီးသွားရင်တောင် client မှာရှိတဲ့ Full Mirror ကိုယူပြီး restore ပြန်လုပ်နိုင်တယ်။ Client တစ်ခုချင်းစီးတိုင်း Server အတွက် Full Mirror backup တွေဖြစ်နေတာကြောင့် အချိန်မရွေး Restore ပြန်လုပ်နိုင်တယ်။ Limitation တစ်ခုကတော့ Client မှာ ရှိတဲ့ data က latest ဖြစ်နေဖို့တော့လိုတော့ပေါ့၊ မဟုတ်ရင် client မှာရှိတဲ့ version ကိုပဲ restore ပြန်လုပ်နိုင်မှာဖြစ်ပါတယ်။
Server down နေတာ ဒါမှမဟုတ် Client က offline ဖြစ်နေတဲ့ အချိန် တွေလဲ၊ Client မှာ Full Mirror ရှိနေတဲ့ အတွက်ကြောင့် history တွေကို version အလိုက်ကြည့်နိုင်တယ်၊ commit တွေလုပ်ထားနိုင်တယ်။ Server နဲ့ connection ပြန်ရတဲ့ အချိန်မှ Server ကို push လုပ်လို့ရတော့ CVCS လိုမျိုး server ပေါ်မှာ အကုန်မှီခိုနေတာမဟုတ်တော့ အလုပ်လုပ်ရတာ ပိုအဆင်ပြေ လွယ်ကူစေပါတယ်။

Popular posts from this blog

Pigeon Myanmar's free Wireguard VPN

Pigeon Myanmar's free Wireguard VPN  Pigeon Myanmar ရဲ့ Free VPN service ကိုအသုံးပြုရန်အတွက် အောက်ပါ Telegram Chatbot ကို message ပို့ပြီး Config file ဒါမှမဟုတ် QR Code ကိုရယူနိုင်ပါတယ်။ အသုံးမပြုလိုသူများ၊ newvpn request မလုပ်ဖို့မတ္တာရပ်ခံအပ်ပါတယ်၊ client က limit ရှိတာကြောင့် လိုအပ်တဲ့သူတွေမရမှာစိုးလို့ပါ။ Telegram Chat Bot Telegram Chat Bot:  https://t.me/pigeonmyanmarbot Chat Bot မှာ /start ကိုလို့ပို့ပြီး သက်ဆိုင်ရာ Operation ကိုရေးပြီး VPN အသုံးပြုရန်အတွက် QR Code ဒါမှမဟုတ် Config file ရယူနိုင်ပါတယ်။ Telegram Account တစ်ခုကို client တစ်ခုသတ်မှတ်ထားဒါကြောင့် နောက်အကြိမ်တွေ ထပ်မှတ်ရယူပါကလည်း client အဟောင်းကိုသာ ရရှိတော့မှဖြစ်ပါတယ်။ QR Code/Config File ကို ပျောက်ပျက်သွားတဲ့အခါမှာလည်း ထပ်မံတောင်းခံ ကြည့်ရှူနိုင်ပါတယ်။   /newvpnqr - VPN QR Code ရယူရန်။ /newvpn - VPN Config File ရယူရန်။ VPN Installation and Setup သက်ဆိုင်ရာ Application ကိုအောက်ပါ link များမှ install လုပ်ပါ။  Application မှာ  + / Add a tunnel ခလုတ်နှိပ်ပါ။  Create from file or archive ဒါမှမဟုတ် Create from QR

How to use GIT? GIT ကိုဘယ်လို အသုံးပြုကြမလဲ (Cheat sheet)...

How to use GIT?  Git အသုံးပြုပုံကို နားလည်ကျွမ်းကျင်ဖို့ GIT ဘယ်လိုအလုပ်လုပ်လဲ ဆိုတာ နည်းနည်းတော့ သိထားဖို့လိုလိမ့်မယ်။  File ရဲ့ statuses တွေနဲ့ file transitions တွေကို သေချာ နားလည်ထားဖို့လိုတယ်။ File status မှာဆိုရင် file တစ်ခုကို git ကဘယ်အချိန်မှာ track စလုပ်လဲ၊ ဘယ်အချိန်မှာ modified, unmodified, staged statuses တွေဖြစ်သွားလဲဆိုတာတွေ နဲ့ File transitions မှာဆိုရင် file တစ်ခုက ဘယ် command run ရင် local repository မှာရှိတယ်။ ဘယ် command run ရင်တော့ remote repository (server) ကိုရောက်သွားလဲ ဆိုတာတွေကို အနည်းငယ်နားလည်ထားဖို့တော့လိုမယ်။ Git File Statuses Git မှာ file တွေကို track လုပ်နေတဲ့ statuses တွေရှိတယ်။ အဲ့ဒါတွေကတော့ အောက်ပါအတိုင်းဖြစ်တယ်။ Untracked Unmodified Modified Staged Untracked Status Untracked ဆိုတာက file တစ်ခုက ပထမဆုံး create လုပ်ပြီးတဲအချိန်မှာ git က အဲ့ file ကိုလုံးဝ track မလုပ်ရသေးတဲ့ file တွေက git မှာ untracked အနေနဲ့ရှိနေတယ်။ အဲ့ဒါကို git ကို စပြီး track လုပ်စေချင်တယ်ဆိုင်တော့ git add <file> command နဲ့ git ကို စ track လုပ်ခိုင်းလို့ရတယ်။ အဲ့လို git add လုပ်လို

Editor Config

Editor Config ကျွန်တော်တို့ Developer တွေတော်တော်များများက၊ ကိုယ်နဲ့ကျွမ်းကျင်ရာ ဒါမှမဟုတ် နှစ်သက်ရာ IDE/Text Editor တွေကို သုံးလေ့ရှိကြပါတယ်။ အဲ့နေရာမှာ ပြသနာတစ်ခုက IDE/Text Editor မတူတာနဲ့ Coding Style, Format တွေမှာ မတူတာ တွေဖြစ်တတ်ကြပါတယ်။ ဥပမာ - Eclipse သုံးတဲ့သူ အချင်းချင်းဆို setting ကို export လုပ်ပြီး အတူတူထားလို့ရပေမယ့်၊​ IntelliJ IDEA သုံးတဲ့သူတွေနဲ့ ဆို အဆင်မပြေဖြစ်ပြန်ရော။ Visual Studio Code, Atom, Sublime Text တွေကအများကြီးကို ကြားထဲ Indentation တွေ၊ Code Style တွေကို Standardize လုပ်ဖို့ ခက်ခဲလာတယ်။ အဲ့ဒါကြောင့် တစ်ချို့  Company/Project တွေဆိုရင် ဘယ် IDE/ Text Editor ပဲသုံးရမယ်ဆိုပြီးသတ်မှတ်ထားလေ့ရှိကြတယ်။ အကျိုးဆက်အနေနဲ့ကတော့ Productivity နဲ့ Developers တွေက သတ်မှတ်ထားတဲ့ tools တွေနဲ့ အကျွမ်းဝင်ဖို့ အချိန်ပေးရပါတယ်။ အဲ့ဒါ တွေကို Editor Config ကအလွယ်တကူဖြေရှင်းပေးနိုင်ပါတယ်။ Editor Config ရဲ့ အားသာချက်ကတော့ အတော်များများ IDE/ Text Editor တွေမှာ built-in ပါပြီးသားဖြစ်ပြီး၊ built-in မပါရင်လဲ Plugin တွေက အတော်များများအတွက်ရှိပါတယ်။  # EditorConfig is awesome: https://Edito