Tập hợp những câu lệnh GIT hữu dụng Ngày đăng: 05/12/2019 193 lượt xem Tập hợp những câu lệnh GIT hữu dụng Git config git config --global user.name "John Doe" git config --global user.email "[email protected]mple.com" --global được sử dụng để áp dụng cho tất cả các projects. Nếu bạn ko sử dụng --global thì settings sẽ chỉ dùng cho riêng project đó. Giúp Git bỏ qua file modes cd project/ git config core.filemode false Liệt kê những settings đang sử dụng git config --list Clone một remote repo git clone https://github.com/user/repository.git Xem thông tin trợ giúp cho một câu lệnh git git help clone Update và merge branch hiện tại với một remote repo cd repo/ git pull origin master Liệt kê các remote urls git remote -v Thay đổi origin url git remote set-url origin https://github.com/repo.git Thêm remote repo git remote add remote-name https://github.com/user/repo.git Xem thay đổi giữa local mà master git diff Xem thay đổi trước khi push git diff --cached origin/master Xem thông tin cụ thể của một commit git show COMMIT_ID Kiểm tra status của working tree git status Đổi message của commit cuối git commit --amend -m "New commit mesage" Revert một commit rồi push git revert COMMIT_ID git push origin master Revert đến thời điểm trước một commit git reset COMMIT_ID git reset --soft [email protected]{1} git commit -m "Revert to COMMIT_ID" git reset --hard Undo commit gần nhất, vẫn giữ thay đổi ở local git reset --soft HEAD~1