|
1 | 1 | # 前言 |
2 | 2 |
|
3 | | -本开源知识库致力成为一个计算机开源的知识框架,该项目还在萌芽起步阶段,在编写的过程中难免遇到错误和不足,非常欢迎大家能够给出自己的意见,成为这个开源项目的贡献者。 |
| 3 | +本开源项目还在萌芽起步阶段,在编写的过程中难免遇到错误和不足,非常欢迎大家能够给出自己的意见,成为这个开源项目的贡献者。 |
4 | 4 |
|
5 | 5 | 这里有两种方式可以对项目进行指正和贡献。 |
6 | 6 |
|
7 | | -**issue**:如果内容上有错误和不足,可以直接在 issue 中提出来(关于 issue 可在网页上直接操作,这里就不说明) |
| 7 | +- **issue**:如果内容上有错误和不足,可以直接在 issue 中提出来(关于 issue 可在网页上直接操作,这里就不说明) |
8 | 8 |
|
9 | | -**contribution**:当然如果你有更好的想法,可以直接贡献你的 contribution(下文将教你如何进行开源共享) |
| 9 | +- **contribution**:当然如果你有更好的想法,可以直接贡献你的 contribution(下文将教你如何进行开源共享) |
10 | 10 |
|
11 | 11 |
|
12 | 12 |
|
|
27 | 27 |
|
28 | 28 |
|
29 | 29 |
|
30 | | -``` |
31 | | -`git clone "url you just copied"` |
| 30 | +```shell |
| 31 | +git clone "url you just copied" |
32 | 32 | ``` |
33 | 33 |
|
34 | 34 |
|
|
37 | 37 |
|
38 | 38 | 例如: |
39 | 39 |
|
40 | | -``` |
41 | | -`git clone [https://github.com/this-is-you/first-contributions.git](https://github.com/this-is-you/first-contributions.git)` |
| 40 | +```shell |
| 41 | +git clone https://github.com/this-is-you/first-contributions.git |
42 | 42 | ``` |
43 | 43 |
|
44 | 44 | 这里的 `this-is-you` 是你的GitHub账户. 复制你first-contributions 这个项目的内容到你的电脑。 |
|
49 | 49 |
|
50 | 50 | 在你的电脑中改变一个仓库文件夹 (如果你还没到这一步): |
51 | 51 |
|
52 | | -``` |
53 | | -`cd first-contributions` |
| 52 | +```shell |
| 53 | +cd first-contributions |
54 | 54 | ``` |
55 | 55 |
|
56 | 56 | 创建一个分支使用 `git checkout` 命令: |
57 | 57 |
|
58 | | -``` |
59 | | -`git checkout -b <add-your-name>` |
| 58 | +```shell |
| 59 | +git checkout -b <add-your-name> |
60 | 60 | ``` |
61 | 61 |
|
62 | 62 | 例如: |
63 | 63 |
|
64 | | -``` |
65 | | -`git checkout -b add-alonzo-church` |
| 64 | +```shell |
| 65 | +git checkout -b add-alonzo-church |
66 | 66 | ``` |
67 | 67 |
|
68 | 68 | (分支的名称不需要 *add* 这个词, 但有一种情况可以加上,就是把你的名字加上去。) |
|
73 | 73 |
|
74 | 74 | 用编辑器打开 `Contributors.md` 这个文件, 把你的名字加进去然后保存.在这个目录下执行 `git status`, 你就会发现已经有变化了. 把改变的文件加入你的分支只需要执行 `git add`命令: |
75 | 75 |
|
76 | | -``` |
77 | | -`git add Contributors.md` |
| 76 | +```shell |
| 77 | +git add Contributors.md |
78 | 78 | ``` |
79 | 79 |
|
80 | 80 | 递交刚才的文件执行 `git commit` 命令: |
81 | 81 |
|
82 | | -``` |
83 | | -`git commit -m "Add <your-name> to Contributors list"` |
| 82 | +```shell |
| 83 | +git commit -m "Add <your-name> to Contributors list" |
84 | 84 | ``` |
85 | 85 |
|
86 | 86 | 替换 ``成你的名字 |
|
89 | 89 |
|
90 | 90 | 推送变动执行 `git push`: |
91 | 91 |
|
92 | | -``` |
93 | | -`git push origin <add-your-name>` |
| 92 | +```shell |
| 93 | +git push origin <add-your-name> |
94 | 94 | ``` |
95 | 95 |
|
96 | | -替换 ``成你之前创建的分支名称 |
| 96 | +替换成你之前创建的分支名称 |
97 | 97 |
|
98 | 98 |
|
99 | 99 |
|
|
115 | 115 |
|
116 | 116 | 首先,切换主分支 |
117 | 117 |
|
118 | | -``` |
119 | | -`git checkout master` |
| 118 | +```shell |
| 119 | +git checkout master |
120 | 120 | ``` |
121 | 121 |
|
122 | 122 | 然后加上仓库的地址 `upstream remote url`: |
123 | 123 |
|
124 | | -``` |
125 | | -`git remote add upstream [https://github.com/Roshanjossey/first-contributions](https://github.com/Roshanjossey/first-contributions)` |
| 124 | +```shell |
| 125 | +git remote add upstream https://github.com/Roshanjossey/first-contributions |
126 | 126 | ``` |
127 | 127 |
|
128 | 128 | This is a way of telling git that another version of this project exists in the specified url and we’re calling it `upstream`. Once the changes are merged, fetch the new version of my repository: |
129 | 129 |
|
130 | | -``` |
131 | | -`git fetch upstream` |
| 130 | +```shell |
| 131 | +git fetch upstream |
132 | 132 | ``` |
133 | 133 |
|
134 | 134 | Here we’re fetching all the changes in my fork (upstream remote). Now, you need to merge the new revision of my repository into your master branch. |
135 | 135 |
|
136 | | -``` |
137 | | -`git rebase upstream/master` |
| 136 | +```shell |
| 137 | +git rebase upstream/master |
138 | 138 | ``` |
139 | 139 |
|
140 | 140 | Here you’re applying all the changes you fetched to master branch. If you push the master branch now, your fork will also have the changes: |
141 | 141 |
|
142 | | -``` |
143 | | -`git push origin master` |
| 142 | +```shell |
| 143 | +git push origin master |
144 | 144 | ``` |
145 | 145 |
|
146 | 146 | Notice here you’re pushing to the remote named origin. |
147 | 147 |
|
148 | 148 | At this point I have merged your branch ``into my master branch, and you have merged my master branch into your own master branch. Your branch is now no longer needed, so you may delete it: |
149 | 149 |
|
150 | | -``` |
151 | | -`git branch -d <add-your-name>` |
| 150 | +```shell |
| 151 | +git branch -d <add-your-name> |
152 | 152 | ``` |
153 | 153 |
|
154 | 154 | 同样你可以删除你远程仓库 |
155 | 155 |
|
156 | | -``` |
157 | | -`git push origin --delete <add-your-name>` |
| 156 | +```shell |
| 157 | +git push origin --delete <add-your-name> |
158 | 158 | ``` |
159 | 159 |
|
160 | 160 | 这不是必须的, but the name of this branch shows its rather special purpose. Its life can be made correspondingly short. |
|
0 commit comments