Git让你追踪代码变化、回退错误、多人协作。程序员必会。
核心概念
仓库=项目文件夹 / 提交=保存快照 / 分支=平行开发线 / 合并=分支合回
十大常用命令
git init # 初始化
git add . # 暂存
git commit -m "描述" # 提交
git status # 状态
git log --oneline # 历史
git branch feature # 创建分支
git checkout feature # 切换分支
git merge feature # 合并
git remote add origin URL # 关联远程
git push -u origin main # 推送
💡 好习惯
提交信息要有意义 / 频繁小提交优于偶尔大提交 / 分支开发再合并 / .gitignore忽略临时文件