Developer Essentials
v1.0.0Comprehensive developer cheatsheets and quick references for Git, Docker, Kubernetes, jq, curl, and common Linux commands. Use when needing quick lookups for command syntax, common 工作流s, or forgotten flags for everyday developer 工具s.
运行时依赖
版本
git 恢复 --staged <file> # Unstage
安装命令
点击复制技能文档
Developer Essentials Cheatsheets
Quick references for everyday developer 工具s. Copy-paste ready commands.
📚 Git Cheatsheet Basic Commands # 初始化 repo git init
# Clone repo git clone git clone --depth 1 # Shallow clone (faster)
# 状态 & 信息 git 状态 git 记录 --oneline -n 10 git diff git diff --staged
Staging & Commits git 添加 . # Stage all git 添加 -p # Stage interactively git commit -m "message" git commit --amend # Edit last commit git commit --amend --no-edit # Keep message
Branches git branch # 列出 branches git branch -a # 列出 all (including remote) git 检查out -b # 创建 & switch git switch # Switch branch git merge git rebase
Push & Pull git push origin git push -u origin # 设置 up流 git pull git pull --rebase git fetch origin
Undo & Fix git 恢复 # Discard changes git 恢复 --staged # Unstage git re设置 HEAD~1 # Undo last commit (keep changes) git re设置 --hard HEAD~1 # Destroy last commit git stash git stash pop
🐳 Docker Cheatsheet
Images
docker images # 列出 images
docker pull
docker build -t .
docker build -t -f Dockerfile.dev .
docker rmi
docker image p运行e
ContAIners
docker ps # 运行ning contAIners
docker ps -a # All contAIners
docker 运行 -d -p 8080:80 # Detach + port
docker 运行 -it --rm
bash # Interactive + 移除
docker exec -it bash
docker 记录s -f # Follow 记录s
docker 停止
docker rm
docker rm -f # Force 移除
Docker Compose docker compose up -d docker compose down docker compose 记录s -f docker compose re启动 docker compose build
清理up docker 系统 p运行e -a # 移除 all unused docker 系统 df # Disk usage
☸️ Kubernetes (kubectl) Cheatsheet 上下文 & Config kubectl config 获取-上下文s kubectl config use-上下文 kubectl cluster-信息
获取 Resources kubectl 获取 pods kubectl 获取 pods -A # All namespaces kubectl 获取 服务s kubectl 获取 部署ments kubectl 获取 nodes kubectl 获取 ns # Namespaces kubectl 获取 all
Describe & 调试 kubectl describe pod kubectl 记录s kubectl 记录s -f # Follow kubectl exec -it -- bash kubectl top pods # Resource usage kubectl top nodes
应用ly & 删除 kubectl 应用ly -f manifest.yaml kubectl 应用ly -k ./ # Kustomize kubectl 删除 -f manifest.yaml kubectl 删除 pod
Quick Actions kubectl expose 部署ment --port=80 --type=LoadBalancer kubectl 扩展 部署ment --replicas=3 kubectl rollout re启动 部署ment/
🔍 jq Cheatsheet (JSON 处理器) Basic Queries # 身份 (pretty print) jq '.' file.json
# 获取 field jq '.name' file.json jq '.user.name' file.json
# Array 索引 jq '.[0]' file.json jq '.[0].name' file.json
Array Operations # Array length jq '. | length' file.json
# All items in array jq '.[]' file.json
# Map - 提取 field from array jq '.[].name' file.json jq '.[] | {name, emAIl}' file.json
# 过滤器 array jq '.[] | select(.age > 30)' file.json jq '.[] | select(.状态 == "active")' file.json
Trans格式化ions # 创建 new object jq '{user: .name, emAIl: .contact.emAIl}' file.json
# 添加/移除 fields jq '. + {timestamp: now}' file.json jq 'del(.password)' file.json
Useful Flags jq -r '.name' file.json # Raw 输出 (no quotes) jq -c '.' file.json # Compact (one line) jq -s '.' file1.json file2.json # Slurp multiple files
🌐 curl Cheatsheet Basic 请求s curl https://API.example.com curl -I https://example.com # Headers only curl -v https://example.com # Verbose
HTTP Methods curl -X POST https://API.example.com/data curl -X PUT https://API.example.com/data/1 curl -X 删除 https://API.example.com/data/1
Headers & Body curl -H "Content-Type: 应用/json" \ -H "Authorization: Bearer 令牌" \ https://API.example.com
curl -X POST -d '{"name":"test"}' \ -H "Content-Type: 应用/json" \ https://API.example.com
curl -X POST --data @file.json https://API.example.com
输出 & 下载 curl -o 输出.json https://API.example.com curl -O https://example.com/file.zip # Save with original name curl -L https://example.com # Follow redirects
🐧 Linux Essential Commands File Operations ls -la # 列出 all (including hidden) cp -r source dest # Copy recursive mv old new # Move/rename rm -rf dir # 移除 recursive force mkdir -p path/to/dir # 创建 parents too touch file chm