Push code len branch thong thuong:
-
git branch: xem minh dang branch nào
-
git branch -a: xem co bao nhieu branch dang o local cua minh. Neu co het roi thi continue 3: Neu chua thi download no ve:
2.1. git fetch --all
2.2. git branch -a : de check
Muon pull branch nao ve de lam viec:
2.3. git checkout -b main origin/man (vd branch main origin/... khi git branch -a se thay)
Luu y la khi muon add 1 so file chinh sua hien tai vao branch moi pull ve thi copy file do bo cho khac chu khi pull ve minh k thay no nua phai mac cong pull lai branch cu cua minh. Sau do copy file muon add vao branch kia roi git add . (co the add file can add thoi)
VD: git add ios/src/TTSCBackend.cpp (git status no se co ios/src/TTSCBackend.cpp) sau do check lai git status mau xanh la thanh cong) -> roi git commit -> git push origin -> done.
-
git status: xem nhung file nào thay doi (màu red)
-
git checkout -b <tên> : de tao branch moi push code hien tai minh code lên
-
git add .
-
git status: xem cac file (mau do) da thanh mau xanh chua (mau xanh la add done)
-
git commit -m ""
-
git push -u origin
Connect cu can xoa va tao connect toi repo moi:
cd C:\Users<username>\Desktop\my-project
- git remote -v
- git remote rm origin
- git remote add origin https://gitlab.com//
- git checkout dev
- git add .
- git commit -m "Thay doi repo duoc remote"
- git push origin dev
Merge:
- git branch: xem mình dang branch nào
- git checkout -b <tên> : de tao branch moi push code hien tai minh code lên
- git add .
- git commit -m ""
- git push -u origin
Truoc khi merge gi thi phai pull cai source minh muon merge nó o trang thai update moi nhat:
- git checkout
- git pull origin Dam bao minh dang o branch ma minh muon merge thi moi merge
- git branch
- git merge
Sau khi xu ly conflict: git add . git commit -m "merge branch <tên branch c? minh> into " git log --oneline
Checkout ve lai branch cua minh git checkout <> git merge git push origin