Git 提交技能,用于提交代码变更时,包括主仓库和子模块提交。
使用 Conventional Commits 规范:
<type>: <description>
git commit -m "feat: 添加新功能"
git commit -m "fix: 修复登录问题"
git commit -m "docs: 更新 README"
git status
查看未提交的变更,包括:
# 添加单个文件
git add <file>
# 添加所有修改
git add -A
git commit -m "<type>: <description>"
git status
确认提交成功,当前分支应领先 origin/main n 个提交。
git push
# 进入子模块目录
cd docs/handbook
# 检查状态
git status
# 添加并提交
git add -A
git commit -m "docs: 更新文档"
# 推送到远程
git push
# 返回主仓库
cd ../..
# 添加子模块引用
git add docs/handbook
# 提交
git commit -m "chore: update handbook submodule"
# 推送
git push
git add -A
git commit -m "feat: 添加用户认证功能"
git push
git add docs/README.md
git commit -m "docs: 更新使用说明"
git push
cd docs/gallery
git add -A
git commit -m "docs: 添加新示例"
git push
cd ..
git add docs/gallery
git commit -m "chore: update gallery submodule"
git push