Git 工作流完全指南

Git 工作流完全指南 Git 是目前最流行的版本控制系统。本文将介绍从基础命令到高级工作流的完整 Git 使用指南,帮助你更高效地进行版本管理和团队协作。 基础配置 初始设置 # 配置用户信息 git config --global user.name "Your Name" git config --global user.email "your.email@example.com" # 配置默认编辑器 git config --global core.editor "vim" # 配置别名(提高效率) git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit # 查看配置 git config --list 忽略文件配置 # .gitignore 示例 # 依赖目录 node_modules/ vendor/ # 编译输出 dist/ build/ *.exe *.dll # IDE 配置 .idea/ .vscode/ *.swp *.swo # 日志文件 *.log logs/ # 环境变量 .env .env.local .env.production # 操作系统文件 .DS_Store Thumbs.db 基础工作流 日常开发流程 # 1. 获取最新代码 git pull origin main # 2. 创建功能分支 git checkout -b feature/new-feature # 3. 开发并提交 git add . git commit -m "feat: add new feature" # 4. 推送到远程 git push origin feature/new-feature # 5. 创建 Pull Request 并合并 # ... # 6. 清理分支 git checkout main git pull origin main git branch -d feature/new-feature 提交规范 使用 Conventional Commits 规范: ...

March 5, 2024 · 技术博主