
第一部分从 GitHub 下载项目到本地方法一克隆到本地推荐步骤第1步打开你的 GitHub 仓库 https://github.com/fengfengfff/IntelligentCommunity 第2步点击绿色的 Code 按钮 ↓ 第3步选择 Local → HTTPS ↓ 第4步复制仓库地址 https://github.com/fengfengfff/IntelligentCommunity.git 第5步打开 Git Bash或终端 ↓ 第6步进入你想存放项目的目录 cd /d/项目存放目录 第7步执行克隆命令 git clone https://github.com/fengfengfff/IntelligentCommunity.git 第8步等待下载完成 ↓ 第9步进入项目目录 cd IntelligentCommunity 第10步用 Qt Creator 打开 IntelligentCommunity.pro方法二下载 ZIP 压缩包步骤第1步打开你的 GitHub 仓库 https://github.com/fengfengfff/IntelligentCommunity 第2步点击绿色的 Code 按钮 ↓ 第3步选择 Download ZIP ↓ 第4步浏览器会自动下载一个 ZIP 文件 ↓ 第5步解压 ZIP 文件到你的工作目录 ↓ 第6步用 Qt Creator 打开 IntelligentCommunity.pro方法三在另一台电脑上克隆# 在新电脑上 git clone https://github.com/fengfengfff/IntelligentCommunity.git cd IntelligentCommunity # 然后用 Qt Creator 打开项目第二部分GitHub 完整使用教程1. GitHub 核心概念概念说明Repository仓库存放项目代码的地方Branch分支代码的不同版本线Commit提交保存代码变更的快照Push推送上传本地提交到 GitHubPull拉取下载 GitHub 上的更新Clone克隆复制整个仓库到本地Fork复刻复制别人的仓库到自己的账号Pull RequestPR请求合并代码的请求2. 日常操作流程流程 A首次克隆项目# 1. 克隆仓库 git clone https://github.com/用户名/仓库名.git # 2. 进入项目目录 cd 仓库名 # 3. 查看远程仓库 git remote -v # 4. 查看分支 git branch -a流程 B修改代码后提交# 1. 查看修改状态 git status # 2. 添加修改到暂存区 git add . # 3. 提交到本地 git commit -m feat: 添加新功能 # 4. 推送到 GitHub git push流程 C从 GitHub 拉取更新# 拉取最新代码 git pull # 或者 git fetch git merge origin/main3. 分支管理创建和切换分支# 查看所有分支 git branch # 创建新分支 git branch feature/new-feature # 切换分支 git checkout feature/new-feature # 创建并切换一步完成 git checkout -b feature/new-feature # 切换到 main 分支 git checkout main合并分支# 1. 切换到目标分支 git checkout main # 2. 合并分支 git merge feature/new-feature # 3. 推送 git push删除分支# 删除本地分支 git branch -d feature/new-feature # 删除远程分支 git push origin --delete feature/new-feature4. Pull Request拉取请求场景贡献代码到别人的仓库第1步Fork 别人的仓库到你的账号 ↓ 第2步克隆你 Fork 的仓库到本地 ↓ 第3步创建新分支修改代码 ↓ 第4步推送你的分支 ↓ 第5步在 GitHub 上点击 New Pull Request ↓ 第6步选择 base目标仓库和 compare你的分支 ↓ 第7步填写描述点击 Create Pull Request ↓ 第8步等待仓库所有者审核和合并5. 常用 Git 命令速查命令说明git init初始化 Git 仓库git clone URL克隆远程仓库git status查看文件状态git add .添加所有文件到暂存区git add 文件名添加指定文件git commit -m 信息提交到本地仓库git push推送到远程仓库git pull拉取远程更新git fetch获取远程更新不合并git branch查看本地分支git checkout 分支名切换分支git checkout -b 分支名创建并切换分支git merge 分支名合并分支git remote -v查看远程仓库地址git log --oneline查看提交历史git diff查看修改内容git reset --hard HEAD~1撤销最近一次提交git stash临时保存修改 第三部分GitHub 小技巧️ 1. 设置默认分支仓库页面 → Settings → Branches → Default branch → 选择 main 或 master → Update2. 创建.gitignore模板GitHub 提供了常见语言的.gitignore模板创建仓库时 → Add .gitignore → 选择 C 或 Qt3. 给项目 Star收藏点击仓库右上角的 ⭐ Star 按钮 可以收藏喜欢的项目4. 完善 README.md好的 README 包含项目名称和描述功能截图技术栈安装和使用说明贡献指南许可证5. GitHub 搜索技巧# 按语言搜索 language:cpp qt # 按 Stars 搜索 stars:1000 # 按更新时间搜索 pushed:2026-01-01 # 组合搜索 qt language:cpp stars:5006. GitHub 仓库快捷键快捷键功能t快速查找文件w切换分支s聚焦搜索框l跳转到文件列表/聚焦搜索框7. 在 README 中添加图片8. 创建组织Organization适合团队协作可以管理多个仓库和成员右上角头像 → Settings → Organizations → New organization9. 使用 Release发布版本仓库页面 → Releases → Create a new release → 填写版本号如 v1.0.0 → 上传编译好的程序.exe → 点击 Publish release10. GitHub 保护分支仓库页面 → Settings → Branches → Add rule → 输入分支名如 main → 勾选 Require pull request reviews → 勾选 Require status checks to pass → 点击 Create第四部分你的项目在面试中展示面试时这样说我把这个项目托管在 GitHub 上https://github.com/fengfengfff/IntelligentCommunity。面试官可以查看完整代码、提交历史了解我的编码风格和项目组织能力。项目代码注释完善采用 MVC 架构包含 17 个功能模块代码量 6500 行。总结操作命令克隆项目git clone URL提交代码git add .git commit -m 信息git push拉取更新git pull创建分支git checkout -b 新分支名合并分支git merge 分支名查看状态git status查看历史git log --oneline你的 GitHub 仓库https://github.com/fengfengfff/IntelligentCommunity