Skip to content

Commit f111917

Browse files
committed
fix typo
1 parent 7e46563 commit f111917

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

docs/tools/Git.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Git 有三种状态,你的文件可能处于其中之一:
154154
主体部分当然也可以有几段,但是一定要注意换行和句子不要太长。因为这样在使用 "git log" 的时候会有缩进比较好看。
155155

156156
提交的标题行描述应该尽量的清晰和尽量的一句话概括。这样就方便相关的 Git 日志查看工具显示和其他人的阅读。
157-
157+
158158
### 推送改动到远程仓库
159159

160160
- 如果你还没有克隆现有仓库,并欲将你的仓库连接到某个远程服务器,你可以使用如下命令添加:·`git remote add origin <server>` ,比如我们要让本地的一个仓库和 Github 上创建的一个仓库关联可以这样`git remote add origin https://github.com/Snailclimb/test.git`
@@ -164,7 +164,7 @@ Git 有三种状态,你的文件可能处于其中之一:
164164

165165
### 远程仓库的移除与重命名
166166

167-
- 将 test 重命名位 test1:`git remote rename test test1`
167+
- 将 test 重命名为 test1:`git remote rename test test1`
168168
- 移除远程仓库 test1:`git remote rm test1`
169169

170170
### 查看提交历史
@@ -183,31 +183,30 @@ git log --author=bob
183183

184184
有时候我们提交完了才发现漏掉了几个文件没有添加,或者提交信息写错了。 此时,可以运行带有 `--amend` 选项的提交命令尝试重新提交:
185185

186-
```console
186+
```shell
187187
git commit --amend
188188
```
189189

190190
取消暂存的文件
191191

192-
```console
192+
```shell
193193
git reset filename
194194
```
195195

196196
撤消对文件的修改:
197197

198-
```
198+
```shell
199199
git checkout -- filename
200200
```
201201

202202
假如你想丢弃你在本地的所有改动与提交,可以到服务器上获取最新的版本历史,并将你本地主分支指向它:
203203

204-
```
204+
```shell
205205
git fetch origin
206206
git reset --hard origin/master
207207
```
208208

209209

210-
211210
### 分支
212211

213212
分支是用来将特性开发绝缘开来的。在你创建仓库的时候,*master* 是“默认的”分支。在其他分支上进行开发,完成后再将它们合并到主分支上。
@@ -216,13 +215,13 @@ git reset --hard origin/master
216215

217216
创建一个名字叫做 test 的分支
218217

219-
```console
218+
```shell
220219
git branch test
221220
```
222221

223222
切换当前分支到 test(当你切换分支的时候,Git 会重置你的工作目录,使其看起来像回到了你在那个分支上最后一次提交的样子。 Git 会自动添加、删除、修改文件以确保此时你的工作目录和这个分支最后一次提交时的样子一模一样)
224223

225-
```console
224+
```shell
226225
git checkout test
227226
```
228227

@@ -232,39 +231,39 @@ git checkout test
232231

233232
你也可以直接这样创建分支并切换过去(上面两条命令的合写)
234233

235-
```console
234+
```shell
236235
git checkout -b feature_x
237236
```
238237

239238
切换到主分支
240239

241-
```
240+
```shell
242241
git checkout master
243242
```
244243

245244
合并分支(可能会有冲突)
246245

247-
```java
246+
```shell
248247
git merge test
249248
```
250249

251250
把新建的分支删掉
252251

253-
```
252+
```shell
254253
git branch -d feature_x
255254
```
256255

257256
将分支推送到远端仓库(推送成功后其他人可见):
258257

259-
```
260-
git push origin
258+
```shell
259+
git push origin
261260
```
262261

263262
## 推荐
264263

265264
**在线演示学习工具:**
266265

267-
「补充,来自[issue729](https://github.com/Snailclimb/JavaGuide/issues/729)」Learn Git Branching https://oschina.gitee.io/learn-git-branching/ 。该网站可以方便的演示基本的git操作,讲解得明明白白。每一个基本命令的作用和结果。
266+
「补充,来自[issue729](https://github.com/Snailclimb/JavaGuide/issues/729)」Learn Git Branching https://oschina.gitee.io/learn-git-branching/。该网站可以方便的演示基本的git操作,讲解得明明白白。每一个基本命令的作用和结果。
268267

269268
**推荐阅读:**
270269

0 commit comments

Comments
 (0)