阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

git 日志

194次阅读
没有评论

共计 1893 个字符,预计需要花费 5 分钟才能阅读完成。

git log

查看历史的 git commit 快照操作

[root@zutuanxue git_data]# git log
commit 326e57a3f87de546c8c17774f174192e280e36fc (HEAD -> master)
# 哈希字符串的描述信息 HEAD->master 表示当前工作目录所对应的 commit,会随着新的 commit 变化(在个别版本中使用 git log 不会显示 HEAD 字样内容,需要使用 git log --decorate)
Author: aaa <hello@localhost>
# 作者
Date: Mon Apr 6 01:00:27 2020 -0400
# 时间
v2 a #git commit - m 添加的描述信息
commit 8f01c62906ee7c06489aae7afb42adaa3da90fdc
Author: aaa <hello@localhost>
Date: Mon Apr 6 00:43:55 2020 -0400
version2 a
commit a714e37d98c3ab77cfa27f0d0a1ca773c6e4ce57
Author: aaa <hello@localhost>
Date: Sun Apr 5 06:26:53 2020 -0400
a
commit 47a267cc489a93f8fab100d7f945a15209f61240
Author: aaa <hello@localhost>
Date: Sun Apr 5 06:25:51 2020 -0400
a.txt
commit 6ac34be689eda430ffefc12114fde40759d536b0
Author: aaa <hello@localhost>
Date: Sun Apr 5 06:21:02 2020 -0400
a
[root@zutuanxue git_data]# git log --oneline #简单的形式展示内容,只显示哈希标识符的前几位
326e57a (HEAD -> master) v2 a
8f01c62 version2 a
a714e37 a
47a267c a.txt
6ac34be a
############################
[root@zutuanxue git_data]# echo 123 >> a
[root@zutuanxue git_data]# git add a
[root@zutuanxue git_data]# git commit -m "test head"
[master 644d678] test head
1 file changed, 1 insertion(+)
[root@zutuanxue git_data]# git log --oneline --decorate
644d678 (HEAD -> master) test head # 产生变化
326e57a v2 a
8f01c62 version2 a
a714e37 a
47a267c a.txt
6ac34be a

git log -p

[root@zutuanxue git_data]# git log -p #显示具体变化的内容,调用了 git diff
commit 644d6785e33714f8f21a3767e39e2013540e1ee2 (HEAD -> master)
Author: aaa <hello@localhost>
Date: Mon Apr 6 01:12:02 2020 -0400
test head
diff --git a/a b/a
index b989558..864e0ba 100644
--- a/a
+++ b/a
@@ -1,3 +1,4 @@
hello
test
test1
+123

git log -n

[root@zutuanxue git_data]# git log -1 #只显示最近几条内容
commit 644d6785e33714f8f21a3767e39e2013540e1ee2 (HEAD -> master)
Author: aaa <hello@localhost>
Date: Mon Apr 6 01:12:02 2020 -0400
test head
[root@zutuanxue git_data]# git log -2
commit 644d6785e33714f8f21a3767e39e2013540e1ee2 (HEAD -> master)
Author: aaa <hello@localhost>
Date: Mon Apr 6 01:12:02 2020 -0400
test head
commit 326e57a3f87de546c8c17774f174192e280e36fc
Author: aaa <hello@localhost>
Date: Mon Apr 6 01:00:27 2020 -0400
v2 a

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-06-09发表,共计1893字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中