Skip to main content

Command Palette

Search for a command to run...

Git Basic part 1

Updated
2 min read
Git Basic part 1

Git account မရှိသေးရင် GitHub, GitLab, Bitbucket တို့မှာ အခမဲ့ ဖွင့်လို့ရပါတယ်၊ ကျွန်တော်ကတော့ ဒီပို့မှာ GitHub နဲ့ပဲ အဓိက ပြောသွားမှာပါ။ တစ်ခုနဲ့ တစ်ခုတော့ UI နည်းနည်း ကွာပေမယ့် သုံးရမယ့် command တွေကတော့ အတူတူပါပဲ။

Git အကောင့်ရှိပြီဆိုရင် git ကို သုံးဖို့ git client ရှိဖို့တော့ လိုပါသေးတယ် သင့်စက်ထဲမှာ မရှိရင် ထည့်ထားလိုက်ပါ။
🐧Download for Linux
🍏Download for OSX
🪟Download for Windows

ရှိနေပြီးသား ပရောဂျက်ဖိုဒါမှာ git စသုံးမယ်ဆိုရင် ပရောဂျက် ဖိုဒါထဲမှာ terminal ဖွင့်ပြီး git init လို့ရိုက်လိုက်ရုံပါပဲ။ ကျွန်တော် အောက်မှာ ပြထားတဲ့ command တွေကို စမ်းရိုက်ကြည့်ပါ။

mkdir git-basic
cd git-basic
echo "Hello Git" > hello.md
echo "PONG" > ping.md
git init
git add ping.md
git status
git commit -m "added ping.md"

အပေါ်က command တွေကို ပြန်ပြောရမယ်ဆိုရင် git-basic ဆိုတဲ့ ဖိုဒါ ဆောက်လိုက်တယ်၊ အဲ့အထဲမှာ hello.md နဲ့ ping.md ဆိုပြီး နှစ်ဖိုင်ရေးလိုက်တယ်။

ပြီးတော့ အဲ့ ဖိုဒါထဲမှာ git init ဆိုပြီး git repository တစ်ခု တည်ဆောက်လိုက်တယ်။ git status ဆိုတာကတော့ working directory ထဲမှာ လက်ရှိ git အခြေအနေကို ဖေါ်ပြခိုင်းတာပါ။ အဲ့မှာ ကြည့်လိုက်ရင် hello.md နဲ့ ping.me ဆိုပြီး နှစ်ဖိုင်က untracked files တွေအဖြစ်ရှိနေကြောင်း တွေ့ရမှာပါ။

git add ping.md လို့ ရိုက်လိုက်ပြီးမှ git status ကို ထပ်ကြည့်မယ်ဆိုရင်တော့ ping.md ကို tracked new file အဖြစ် ဖေါ်ပြပြီး hello.md ကိုတော့ untracked file အဖြစ်ပဲ မြင်နေရအုံးမှာပါ။ ကျွန်တော်တို့ index ထဲထည့်ပြီးသား ping.md ကို head ထဲရောက်ဖို့အတွက် commmit ရေးပေးဖို့လိုပါတယ်။ commit ရေးဖို့အတွက် git commit -m "added ping.md" ဆိုပြီး ရိုက်လိုက်ရုံပါပဲ ။ အဲ့လိုရိုက်လိုက်တဲ့အခါမှာ git ကို အခုမှ စသုံးတာဆိုရင် ပုံထဲကလိုမျိုး ပေါ်လာနိုင်ပါတယ်။

ပုံထဲကလို ပေါ်လာရင်သူပြောထားတဲ့ command နှစ်ခုကို run ပေးလိုက်ပါ။ ကိုယ့်ရဲ့ အမည်နဲ့ အီးမေးကို ထည့်ပေးထားတော့မှ commit ရေးတာ ဘယ်သူလဲလို့ git က သိပြီး မှတ်တမ်းတင်ပေးထားနိုင်မှာပါ။ ဒီနေရာမှာ --global ဆိုတဲ့ option ကို ထည့်ရိုက်မယ်ဆိုရင် default author အဖြစ် မှတ်ထားမှာ ဖြစ်ပြီး --global မပါရင်တော့ လက်ရှိ repository မှာပဲ ဒီ အမည်နဲ့အီးမေးကို author အဖြစ် မှတ်ထားပေးမှာပါ။

# Example 
git config --global user.email "str@thixpin.me"
git config --global user.name "Soe Thura"

# or
git config user.email "str@thixpin.me"
git config user.name "Soe Thura"

Git config user ကို သတ်မှတ် ပြီးပြီဆိုရင်တော့ commit ပြန်ရေးကြည့်လို့ရပါပြီ။

git commit -m "added ping.md"
git status
git add .
git commit -m "second commit"
git log

git add . ဆိုတာက လက်ရှိ ပြောင်းလဲထားသမျှဖိုင်အကုန်လုံးကို index ထဲထည့်တာပါ။ ပြီးရင် git commit -m "second commit" လို့ရိုက်ပြီး ဒုတိယ commit ရေးခြင်းအားဖြင့် hello.me ကို head ထဲ ထည့်လိုက်နိုင်ပါတယ်။ နောက်ပြီး git log လို့ရိုက်ပြီး commit history ကို quick review အနေနဲ့ ကြည့်လို့ရပါတယ်။ git log ထဲက ပြန်ထွက်ချင်ရင် ကီးဘုတ်မှာ q ကို နှိပ်ပြီး ထွက်လို့ရပါတယ်။

အောက်ပုံကတော့ Git ရဲ့ အခြေခံ အလုပ်လုပ်ပုံ ပါပဲ ကျွန်တော်တို့ working dir ထဲမှာ ဖိုင်တွေပြင်တယ် ဖိုင်အသစ်တွေဆောက်တယ်၊ ပြီးသွားရင် git add ဆိုပြီး index ထဲထည့်တယ် Index က staging area အဖြစ် အလုပ်လုပ်တယ် stage change တွေကို commit လုပ်ပြီးသိမ်းလိုက်တော့ Head က ကိုယ်ရဲ့ နောက်ဆုံး commit ကို point ပေးတယ်။

Git နဲ့ ပတ်သက်ပြီး နောက် အပိုင်းတွေ ဆက်ရေးပေးပါအုံးမယ်၊ ကျွန်တော်က စာရေးနေကြသူမဟုတ်တော့ လိုအပ်တာတွေရှိရင်လည်း အားမနာတမ်း ဝေဖန်ပေးသွားလို့ရပါတယ်။

550 views

More from this blog

Infrastructure ကိုင်ပြီး အိပ်ရေးမပျက် ချင် လျှင် ဒါမျိုး Alarms လုပ် 🔥🔥🔥

High Level ရေးထားတာပါ ဒါပေမဲ့ လွယ်ပါတယ် ​ကိုယ့်မှာ AWS Infra တွေရှိတယ်ဆို တွေ့သမျှ metric တွေကို alarms တွေလုပ်ပြီး notification ယူမနေဘဲ တကယ် effective ဖြစ်တဲ့ metric တွေကိုမှ CloudWatch ရဲ့ alarm feature တွေနဲ့ ပေါင်းပြီး ပို့စေချင်ပါတယ်။ ​ဥပမာ prod...

Jan 17, 20263 min read151
Infrastructure ကိုင်ပြီး အိပ်ရေးမပျက် ချင် လျှင်  ဒါမျိုး Alarms လုပ် 🔥🔥🔥

How to connect On Premises Network and Cloud (AWS)? (Part-2)

ကိုယ့်ရဲ့ ‌data center (on-prem) network နဲ့ AWS ချိတ်ဆက်ဖို့ လိုလာပြီဆိုရင် ဘယ်လို ချိတ်ဆက်ကြမလဲ? အပိုင်း (၂) မှာ တော့ Direct connect အကြောင်းကို ဆွေးနွေး သွားမှာ ဖြစ်ပါတယ်။ အပိုင်း (၁) Site-to-site VPN အကြောင်းကို လေ့လာချင်ရင်တော့ အောက်ပါ link မှာ ...

Dec 20, 20253 min read222
How to connect On Premises Network and Cloud (AWS)? (Part-2)

How to connect On Premises Network and Cloud (AWS)? (Part-1)

ကိုယ့်ရဲ့ ‌data center (on-prem) network နဲ့ AWS ချိတ်ဆက်ဖို့ လိုလာပြီဆိုရင် ချိတ်ဆက်နိုင်တဲ့ နည်း (၂) နည်း ရှိပါတယ်။ 1. Site-to-Site VPN (Virtual Private Network) 2. Direct connect Site-to-Site VPN - On-prem network နဲ့ AWS resources တွေ ချိတ်ဆက်တဲ့...

Dec 12, 20252 min read261
How to connect On Premises Network and Cloud (AWS)? (Part-1)

Accessibility for Designer

လွန်ခဲ့တဲ့အပတ်က ရုံးက Designer တွေနဲ့ တော်ကီပွားရင်း Accessibility နဲ့ပတ်သတ်တာတွေ သူတို့ကို ရှင်းပြဖြစ်တယ်။ ကိုယ်တိုင်ကလည်း အရင်ကတည်းက ဒီ topic ကိုစိတ်ဝင်စားလို့ လေ့လာနေတာဆိုတော့ အခွင့်အရေးရရင် ရသလို sharing လုပ်ဖြစ်တယ်။ အဓိကက Accessibility နဲ့ပတ်သတ်...

Nov 21, 20253 min read67
Accessibility for Designer

VPC Endpoint

အားလုံးဘဲ မင်္ဂလာပါ။ ဒီနေ့ sharing လုပ်ပေးချင်တာကတော့ VPC Endpoint အကြောင်းဘဲဖြစ်ပါတယ်။ VPC Endpoint ဆိုတာ VPC နဲ့ AWS services တွေ ကို public Internet ကို အသုံးမပြုဘဲနဲ့ Privately connect လုပ်ပေးတာ ဖြစ်ပါတယ်။ Internet Gateway, NAT Gateway နဲ့ Public...

Nov 18, 20252 min read88
VPC Endpoint
M

Myanmar Technical Blog

108 posts

Cloud, Linux, DevOps, Docker, Security အစရှိတဲ့ နည်းပညာများ အကြောင်းကို မြန်မာလို ပြန်လည်မျှဝေပေးမယ့် Blog ပဲဖြစ်ပါတယ်ခဗျာ...