├── .all-contributorsrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── semantic.yml ├── .gitignore ├── README.md ├── _config.yml └── 致大一 ├── README.md ├── users ├── Tanger │ └── Main.md ├── sustart │ └── Main.md └── xwt │ └── readme.md └── 解决练习仓的那些坑 ├── README.md └── imgrepo └── metho1.png /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "commit": false, 7 | "contributors": [ 8 | { 9 | "login": "MrGo123", 10 | "name": "sustart", 11 | "avatar_url": "https://avatars1.githubusercontent.com/u/53072382?v=4", 12 | "profile": "https://zy68.top", 13 | "contributions": [ 14 | "doc" 15 | ] 16 | }, 17 | { 18 | "login": "Tanger", 19 | "name": "Tanger", 20 | "avatar_url": "https://avatars.githubusercontent.com/u/104449?v=4", 21 | "profile": "https://github.com/Tanger", 22 | "contributions": [ 23 | "doc" 24 | ] 25 | }, 26 | { 27 | "login": "redhat123456", 28 | "name": "redhat123456", 29 | "avatar_url": "https://avatars.githubusercontent.com/u/57751257?v=4", 30 | "profile": "https://redhat123456.github.io/", 31 | "contributions": [ 32 | "doc" 33 | ] 34 | } 35 | ], 36 | "contributorsPerLine": 7, 37 | "projectName": "Git2Github-practice", 38 | "projectOwner": "seven-innovation-base", 39 | "repoType": "github", 40 | "repoHost": "https://github.com", 41 | "skipCi": true 42 | } 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 问个问题 3 | about: 寻求帮助,解答疑惑 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### 问题描述 11 | 12 | 13 | 14 | ### 复现步骤 15 | 16 | 17 | 18 | 1. 19 | 2. 20 | 3. 21 | 4. 22 | 23 | 24 | ```js 25 | /** 26 | * 这段注释后可以贴代码 27 | * 提供完整可复现的代码和整理好代码格式,有助于我们快速定位问题,节省你我时间 28 | * 代码提供不全或代码格式混乱的 issues 【有可能会被忽略】 29 | * 30 | * 查看如何插入代码:https://coding.net/help/doc/project/markdown.html#i-5 31 | */ 32 | 33 | ``` 34 | 35 | ### 期望行为 36 | 37 | 38 | 39 | ### 报错信息 40 | 41 | 42 | 43 | ### 系统信息 44 | 45 | 46 | 47 | ### 补充信息 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | anyCommit: true 2 | 3 | types: 4 | - feat 5 | - fix 6 | - docs 7 | - style 8 | - refactor 9 | - perf 10 | - test 11 | - build 12 | - ci 13 | - chore 14 | - revert -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # IntelliJ 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/assetWizardSettings.xml 41 | .idea/dictionaries 42 | .idea/libraries 43 | .idea/caches 44 | 45 | # Keystore files 46 | # Uncomment the following line if you do not want to check your keystore files in. 47 | #*.jks 48 | 49 | # External native build folder generated in Android Studio 2.2 and later 50 | .externalNativeBuild 51 | 52 | # Google Services (e.g. APIs or Firebase) 53 | google-services.json 54 | 55 | # Freeline 56 | freeline.py 57 | freeline/ 58 | freeline_project_description.json 59 | 60 | # fastlane 61 | fastlane/report.xml 62 | fastlane/Preview.html 63 | fastlane/screenshots 64 | fastlane/test_output 65 | fastlane/readme.md 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 大家的Git练习仓库 2 | 3 | [](#contributors-) 4 | 5 | 6 | ## 目录 7 | 8 | - [大家的Git练习仓库](#大家的git练习仓库) 9 | - [目录](#目录) 10 | - [前言](#前言) 11 | - [新人需知](致大一/) 12 | - [分支练习](#分支练习) 13 | - [协作之道pr](#协作之道pr) 14 | - [深入学习](#深入学习) 15 | - [已参与娱乐的小伙伴 ✨](#已参与娱乐的小伙伴-) 16 | 17 | ## 前言 18 | 19 | **须知**:本仓库主要用于练习 Git 的使用,提供大家一个展示练习成果的平台。 20 | 21 | 如果你的 organization 角色是 member,那么我们推荐你练习使用 pull request(pr)。 22 | 23 | 如果你的角色[(role)](https://github.com/orgs/seven-innovation-base/people)是 owner,我们仍然推荐你练习使用pull request(pr),不要直接在当前 repository(仓库) 创建分支,先[fork](https://github.com/seven-innovation-base/Git2Github-practice/fork)这个 repository,然后再创建个分支做改动后向本仓库提交pr展示你的练习成果。 24 | 25 | 了解 Fork Projects🍳[{GitHub Guides-Forking Projects}](https://guides.github.com/activities/forking/) 26 | 27 | **如果对Git没一丁点认知,请先阅读😘[新人须知](致大一/)** 28 | 29 | ## 分支练习 30 | 31 | **请大家遵守以下练习规则:** 32 | 33 | - 1. 新加入的同学请 `clone`克隆 main 分支。 34 | - 2. 在 main (主)分支的基础上创建自己的分支,在这个分支里面自由练习。 35 | - 3. 禁止强推 `git push -f` 36 | - 4. 请注意分支命名规则,请用自己的昵称加分支名称命名,如 CkaiGrac-PYMO。禁止出现 test1、dsafqwe 等不规范命名。 37 | 38 | **克隆本项目:** 39 | 40 | ```shell 41 | git clone -b main https://github.com/seven-innovation-base/Git2Github-practice.git --single-branch 42 | ``` 43 | 44 | **查看并创建自己的分支** 45 | 46 | ```shell 47 | # 查看当前分支,默认为 main 分支,按 q 退出 48 | git branch 49 | 50 | # 根据当前所在分支创建自己的分支 51 | git branch CkaiGrac-PYMO 52 | 53 | # 切换到自己的分支 54 | git checkout CkaiGrac-PYMO 55 | 56 | # 再次查看当前分支 57 | git branch 58 | ``` 59 | 60 | **完成自己的练习** 61 | 62 | 在自己的分支上练完后想要提交这一次修改到 GitHub 上: 63 | 64 | - 使用 `git add` 命令,add 后面可以添加单个修改后的文件或者是一个文件夹中所有修改后的文件到本地缓存中。 65 | 66 | - 然后使用 git commit 命令对添加到缓存中的文件添加修改说明。 67 | 68 | ```shell 69 | # 一次性添加所有修改到缓存中,仅适合少量修改,‘.’表示当前路径 70 | # git add . 71 | 72 | git add src/main.java 73 | git commit -m "添加main.java文件" 74 | 75 | git add src/activity.java 76 | git commit -m "新增activity.java文件" 77 | 78 | # 一段时间后,修改了main.java的内容 79 | git add src/main.java 80 | git commit -m "新增xxx函数" 81 | ``` 82 | 83 | **把这次的修改提交到Github上** 84 | ```shell 85 | git push origin CkaiGrac-PYMO 86 | # 命令为git push origin your-branch 87 | ``` 88 | 89 | ## 协作之道pr 90 | 91 | 好了,到了这里,前面的分支学习将真正有“大作为”。在多人合作时,我们可能会有这样一个情景,你 clone 到本地的版本库与远程的版本库历史(commit log)不一致(有可能你 clone 项目后,有人也 clone 了,并对他的修改进行了提交),导致你不能提交「当然,你强制提交也行,但是这并不推荐」。这如何解决呢? 92 | 93 | 在多人合作时,我们有这样的一个分支维护习惯(也许还有更好的): 94 | 95 | - 主分支保持 stable; 96 | - clone 项目后,不在主分支(main)进行修改,而是**新建立一个分支进行修改**; 97 | - 主分支用于同步远程变更,同步完成后在把远程新的变更 merge 到你工作的分支(branch); 98 | 99 | 那么,如何操作,以下是一种基于「 GitHub 演示」良好的实践: 100 | 101 | 我们晓得,一般情况下,如果你不是项目的核心维护者,你是没有权限直接提交修改到项目的仓库的,这时你就会用到 GitHub 的 fork 操作。以下以[基地的文档项目](https://github.com/seven-innovation-base/SphinxDOC)为例子。 102 | 103 | ```bash 104 | # fork 之后你会进行 clone 105 | git clone https://github.com/your_username/SphinxDOC 106 | ``` 107 | 108 | 在你 push 变更到你fork后的仓库时,**你需要注意**:fork 后仓库的历史变更不会和真正的项目仓库历史变更保持同步,在 push 之前,我们会有以下这两波操作解决: 109 | 110 | **方法一**: 111 | 112 | - 1、添加源仓库为你 fork 后仓库的远程上游 113 | 114 | ```bash 115 | git remote add upstream https://github.com/seven-innovation-base/SphinxDOC.git 116 | # 或者 117 | git remote add upstream git@github.com:seven-innovation-base/SphinxDOC.git 118 | ``` 119 | 120 | - 2、切换回主分支(main),同步远程上游的变更,并将变更合并到主分支 121 | 122 | ```bash 123 | git checkout main 124 | git fetch upstream 125 | # 你也阔以看看当前主分支和 upstream 的有什么不同 126 | # git diff upstream/main 127 | git merge upstream/main 128 | ``` 129 | 130 | - 把变更 merge 到你工作的分支,然后 git commit、git push,最后再到 GitHub 提交 pull request 131 | 132 |  133 | 134 | 135 | **方法二:** 136 | 137 | - 1、 自 2021 年 5 月 7 日,GitHub 已经支持一键同步和一键 pull request,在自己 fork 之后的仓库里,``Code`` 下有功能 ``fetch and merge`` (如 下图),能够使得你在网页端的仓库与源仓库同步。 138 | 139 | [](https://imgtu.com/i/g3lJ7n) 140 | 141 | 142 | - 2、 如果你本地工作仓库也需要更新,那么直接 ``git fetch`` 、``git merge`` 即可将本地工作仓库与远程仓库内容同步。 143 | 144 | - 3、 如果你想将自己的修改好的分支推到源仓库上你还需要再(如 下图) 145 | 146 | 147 | 148 | 149 | 150 | 到这里,你应该明白了,应该深入了解波 `git fetch` 和 `git merge` 的相关实践 151 | 152 | 153 | ## 深入学习 154 | 155 | - 这里可能会有你学习和使用 Git 的时候遇到的各种问题 -> [Git 飞行指南](https://github.com/k88hudson/git-flight-rules/blob/master/README_zh-CN.md) 156 | 157 | - 实验楼的这门以战代学的课程不错,有在线模拟环境是它的亮点👉👉[Git与Github入门实践](https://www.shiyanlou.com/courses/1035) 158 | 159 | - 学长学姐告诉你,查文档学习更快,以实际应用场景为驱动,学得更快更有效率(逃~~~,👉👉[Git Documentation](https://git-scm.com/doc) 160 | 161 | - Git 工作流:[GitHub Flow](https://guides.github.com/introduction/flow/) 162 | 163 | - Git 处理大型仓库:[Git 如何处理大仓库](https://www.oschina.net/translate/how-to-handle-big-repositories-with-git) 164 | 165 | - 应对大仓库的 clone 太慢的问题:[断点续传式git clone(伪)-逐步clone](https://blog.csdn.net/zerooffdate/article/details/79348925) 166 | 167 | ## 已参与娱乐的小伙伴 ✨ 168 | 169 | 170 | 171 | 172 |
sustart 📖 |
175 | redhat123456 📖 |
176 | Tanger 📖 |
177 |