Advanced Techniques and Quick Fixes
Quick Fixes - Commit ပြင်ခြင်းနဲ့ Local Changes ကို Undo လုပ်ခြင်း
Section titled “Quick Fixes - Commit ပြင်ခြင်းနဲ့ Local Changes ကို Undo လုပ်ခြင်း”git commit --amend
Section titled “git commit --amend”နောက်ဆုံး commit ထဲကို ပြင်ချင်တာ၊ file တစ်ခု ထပ်ထည့်ချင်တာ၊ commit message မှာ စာလုံးပေါင်းမှားတာ ပြင်ချင်တာတွေကို ဒီ command နဲ့ လုပ်နိုင်ပါတယ်။
ဘယ်လိုလုပ်မလဲ:
အကယ်၍ file တစ်ခု ထည့်ဖို့ မေ့သွားတယ်ဆိုရင်:
git add <file name>git commit --amend
git reset HEAD <file>
Section titled “git reset HEAD <file>”ဒါက file တစ်ခုကို stage မှာထည့်ထားတာ ပြန်ဖြုတ်တာပါ။ file ထဲက changes တွေက မပျောက်ပါဘူး။
အဓိက သုံးတာက git add
လုပ်ပြီးမှ မှားသွားတာတွေကို unstage ပြန်ဖြုတ်ချင်ရင် သုံးပါတယ်။
Command: git reset HEAD <file နာမည်>
(အကုန်လုံးကို unstages လုပ်ချင်ရင် git reset HEAD ကို သုံးပါ)
git checkout -- <file> (သတိထားပြီး သုံးပါ)
Section titled “git checkout -- <file> (သတိထားပြီး သုံးပါ)”ဒါက file တစ်ခုထဲက လက်ရှိပြင်ထားတဲ့ changes တွေကို လုံးဝ ပယ်ဖျက်ပစ်တာပါ။ file ကို last commit (HEAD) အတိုင်း ပြန်ပြောင်းပေးပါတယ်။
file ထဲမှာ ပြောင်းလဲမှုတွေ မလိုချင်တော့ဘူးဆိုရင် သုံးပါတယ်။
Command: git checkout -- <file နာမည်>