git 命令

Posted yanghailin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git 命令相关的知识,希望对你有一定的参考价值。

1. 需要指定某个版本的代码,不是最新的

1.1 首先

git pull

把代码更新到最新

1.2

git log

会出来:
commit 6c182f8c2a98665d73a92dd13127503e9f0289c1
Author: hello hello@123.com.cn
Date: Tue Jan 21 16:43:03 2020 +0800

ignore

commit 268976392e0935b4524f287935c1a16be9afc5d0
Author: hello hello@123.com.cn
Date: Tue Jan 21 16:22:27 2020 +0800

将base/utility合并,删除冗余

代码

commit 076bd5c5426a1c257343c98054d8cad582c079f1
Author: hello hello@123.com.cn
Date: Tue Jan 21 11:49:29 2020 +0800

代码精简

commit 9348818c3606e5ed80e4f63e2b657635dadd7711
Author: hello hello@123.com.cn
Date: Tue Jan 21 10:18:02 2020 +0800

1.3

git checkout 9348818c3606e5ed80e4f63e2b657635dadd7711

“9348818c3606e5ed80e4f63e2b657635dadd7711”就是上面某个commit id
会显示:
Note: checking out ‘9348818c3606e5ed80e4f63e2b657635dadd7711‘.

You are in ‘detached HEAD‘ state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

HEAD 目前位于 9348818...容错降为2

以上是关于git 命令的主要内容,如果未能解决你的问题,请参考以下文章

VSCode自定义代码片段15——git命令操作一个完整流程

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

如何管理在每个 git 版本中添加私有代码片段?

使用 Git 来管理 Xcode 中的代码片段

markdown Git代码片段