使用流程
0. 从远程已有仓库开始(只需一次)
场景:GitHub 上已经有仓库了,本地还没有代码。
| 目标 | 命令示例 | 注释 |
|---|---|---|
| 1. 克隆远程仓库 | git clone <your-repo-url> | 如:git clone https://github.com/123awsd/smart_watch.git |
| 2. 进入项目目录 | cd smart_watch | 进入刚克隆下来的项目文件夹。 |
| 3. 检查远程是否正常 | git remote -v | 确认 origin 显示正常即可。 |
1. 初始化流程(仅需一次)
| 目标 | Windows (Git Bash) 命令 | 注释 |
|---|---|---|
| 1. 终端进入项目 | cd /path/to/your/project (或右键 → Git Bash Here) | 确保终端路径正确。 |
| 2. 初始化仓库 | git init | 在当前目录创建 .git 文件夹。 |
| 3. 创建忽略文件 | touch .gitignore | 创建忽略文件。 |
4. 暂存 .gitignore | git add .gitignore | 仅暂存忽略文件。 |
| 5. 首次 Commit | git commit -m "chore: Init repository structure" | 使用 chore 类型。 |
| 6. 关联远程仓库 | git remote add origin <your-repo-url> | 绑定您的远程仓库 URL。 |
| 7. 推送主分支 | git push -u origin master | 首次使用 -u 建立跟踪关系。 |
2. 标准功能开发流程
| 步骤 | Git Bash 命令 | 关键原则与注释 |
|---|---|---|
| 1. 准备 | git checkout master |


