demo_docs/Knowledge Base/Cheatsheet.md
2025-05-14 09:42:59 +07:00

1.5 KiB

1. Git Commands

Command:

  • git checkout -b branch # Tạo nhánh.
  • git pull origin branch # Kéo repo từ nhánh
  • git add . | git add filename# Thêm file vào staging
  • git commit -m "feat: content" # Commit thay đổi theo format scope + nội dung
  • git push origin branch # Đẩy repo lên source code
  • git merge branch # gộp tính năng vào
  • git branch -d ten-nhanh # xóa local
  • git push origin --delete ten-nhanh # xóa remote

Commit Scope

  • Dev Codefeat, fix
  • **Dev Refactor → refactor, perf, style
  • DevOps → build, ci, chore
  • Tester|BAdocs, test
  • Leader | Automationrevert

2. Docker Commands

Command:

  • docker build -t image:tag : tạo docker image từ Dockerfile
  • docker build --cache-from image:tag -t image:tag : Cache
  • docker run --rm -it image:tag sh : Chạy container
  • docker exec -it image:tag bash: Thực hiện lệnh trong Container
  • docker compose down: tắt các docker đang chạy
  • docker compose up -d : chạy lại các docker (background)
  • docker ps -a: Xem danh sách docker đã khởi chạy
  • docker container|image|volume prune -f : Xóa các entity không dùng
  • docker network inspect network:name : Xem chi tiết network

3. Config Init

  • git config --global commit.template ~/.gitmessage.txt : Gắn Template commit template
  • git config --global user.name "Tên của bạn"
  • git config --global user.email "email@example.com"