git clone <remote_repo_url>
git pull
git pull origin <remote_branch_name>
git add .
git add *
git status
git commit -m "<message>"
git log
git log --oneline
git push -u origin master
git push
git push origin master
git push origin master -f
git show <commit_id>
gitk
git diff <commit_id>
git diff <commit_id_1> <commit_id_2>
git reset
git reset <file>
git restore --staged <file>
git revert master
git revert <commit_id>
git checkout -b <branch_name>
git checkout <branch_name>
git branch
git branch -D <branch_name>
git config --global alias.co checkout
- Giup chung ta danh dau cac file k0 can thiet de push len remote
- pull code moi nhat ve tu base (master/develop)
- checkout sang nhanh moi va lam task cua minh
- git add, commit, push origin [current_branch]
- Tao Pull Request (PR), Chon nguoi review neu can, chon nhanh gop (master/develop)
- Tu review lai code, Duoc phe duyet thi merge (Neu co loi thi toi buoc 6)
- Neu co loi xay ra can fix thi chung ta can:
- Ve VSCode xu ly loi
- git add, commit --amend -m "message", push origin [current_branch] -f
- Quay lai buoc 5
- Can tao PR khac de fix PR truoc (it gap)
- Change same file + same line
- A deleted file X, B modified file X
- Checkout ve master + pull code moi nhat ve $ git co master $ git pull
- Checkout sang nhanh bi conflict + su dung rebase $ git br $ git co [conflict_branch] $ git br $ git rebase master
- Vao Visual Code fix conflict su dung hint $ git add . $ git rebase --continue $ git log --oneline
- Push len github $ git push origin [conflict_branch] -f
- Checkout ve master + pull code moi nhat ve $ git co master $ git pull
- Checkout sang nhanh bi conflict + su dung merge $ git br $ git co [conflict_branch] $ git br $ git merge master
- Vao Visual Code fix conflict su dung hint $ git add . $ git ci -m "resolve conflict."
- Push len github $ git push origin [conflict_branch] -f