@@ -80,7 +80,7 @@ Git 的版本库有一个称为 Stage 的暂存区以及最后的 History 版本
8080
8181Git 会使用 \<\<\<\<\<\<\< ,======= ,\>\>\>\>\>\>\> 标记出不同分支的内容,只需要把不同分支中冲突部分修改成一样就能解决冲突。
8282
83- ```
83+ ``` bash
8484<<< <<< < HEAD
8585Creating a new branch is quick & simple.
8686=======
@@ -94,7 +94,7 @@ Creating a new branch is quick AND simple.
9494
9595可以在合并时加上 --no-ff 参数来禁用 Fast forward 模式,并且加上 -m 参数让合并时产生一个新的 commit。
9696
97- ```
97+ ``` bash
9898$ git merge --no-ff -m " merge with no-ff" dev
9999```
100100
@@ -106,7 +106,7 @@ $ git merge --no-ff -m "merge with no-ff" dev
106106
107107可以使用 git stash 将当前分支的修改储藏起来,此时当前工作区的所有修改都会被存到栈中,也就是说当前工作区是干净的,没有任何未提交的修改。此时就可以安全的切换到其它分支上了。
108108
109- ```
109+ ``` bash
110110$ git stash
111111Saved working directory and index state \ " WIP on master: 049d078 added the index file"
112112HEAD is now at 049d078 added the index file (To restore them type " git stash apply" )
@@ -120,7 +120,7 @@ Git 仓库和 Github 中心仓库之间的传输是通过 SSH 加密。
120120
121121如果工作区下没有 .ssh 目录,或者该目录下没有 id_rsa 和 id_rsa.pub 这两个文件,可以通过以下命令来创建 SSH Key:
122122
123- ```
123+ ``` bash
124124$ ssh-keygen -t rsa -C " youremail@example.com"
125125```
126126
@@ -148,7 +148,7 @@ $ ssh-keygen -t rsa -C "youremail@example.com"
148148
149149编辑 ~ /.ssh/config:
150150
151- ```
151+ ``` bash
152152Host github.com
153153 HostName github.com
154154 User git
@@ -162,12 +162,44 @@ Host github.com
162162
163163测试:
164164
165- ```
165+ ``` bash
166166ssh -T git@github.com
167167```
168168
169169完成以上步骤后,Git 就会使用指定的密钥进行身份验证。
170170
171+ ## tag
172+
173+ ``` bash
174+ git tag
175+ ```
176+
177+ 按字母顺序列出所有 tag 名称。
178+
179+ ``` bash
180+ git tag --sort=-creatordate
181+ ```
182+
183+ 这个命令会把最新创建的 tag 排在最前面。
184+
185+ 需要查特定前缀的 tag(比如 v1.)也可以这样:
186+
187+ ``` bash
188+ git tag -l " v1.*"
189+ ```
190+
191+ 要切换(checkout)到某一个 Git tag,可以用下面的命令:
192+
193+ ``` bash
194+ git checkout < tag-name>
195+ ```
196+
197+ ## 指定 ssh 文件
198+
199+ ``` bash
200+ GIT_SSH_COMMAND=' ssh -i {SSH_KEY_PATH} -o StrictHostKeyChecking=no' git clone xxxx
201+ ```
202+
171203## 参考资料
172204
173205- [ Git - 简明指南] ( http://rogerdudler.github.io/git-guide/index.zh.html )
0 commit comments