Git 提交历史一般常用两个命令:
- git log - 查看历史提交记录。
- git blame <file> - 以列表形式查看指定文件的历史修改记录。
git log
在使用 Git 提交了若干更新之后,又或者克隆了某个项目,想回顾下提交历史,我们可以使用 git log 命令查看。
zhuxiaocheng@cheng qianyi_android_mutlan % git log commit cfde9a920f3125e6ed257d087f3be97a4aeed115 (HEAD -> master, origin/master, origin/HEAD) Author: zxchengDate: Thu Oct 27 09:44:55 2022 +0800 修改bug commit feba6595aedea556ee00f8b8d0e86a366deedebd Author: zxcheng Date: Tue Oct 25 21:27:03 2022 +0800 修改bug commit 09ecd617fcff36ca754323478e2d92a4d003eabe Author: zxcheng Date: Tue Oct 25 09:16:06 2022 +0800 twitter登录,分享,修改bug
git blame
如果要查看指定文件的修改记录可以使用 git blame 命令,格式如下:git blame
git blame 命令是以列表形式显示修改记录,如下实例:
git blame build.gradle ^b35db2f (cmf 2022-08-30 12:09:45 +0800 1) // Top-level build file where you can add configuration options common to all sub-projects/modules. ^b35db2f (cmf 2022-08-30 12:09:45 +0800 2) apply from: "config.gradle" ^b35db2f (cmf 2022-08-30 12:09:45 +0800 3) apply from: "dependencies.gradle" ^b35db2f (cmf 2022-08-30 12:09:45 +0800 4) buildscript { ^b35db2f (cmf 2022-08-30 12:09:45 +0800 5) repositories { f374c0c0 (Mitchell Dong 2022-09-23 15:19:15 +0800 6) maven { url 'https://maven.aliyun.com/repository/public/' } f374c0c0 (Mitchell Dong 2022-09-23 15:19:15 +0800 7) maven { url 'https://maven.aliyun.com/repository/google/' } f9d91040 (zxcheng 2022-10-19 09:44:06 +0800 8) // 1.添加MobSDK Maven地址 f9d91040 (zxcheng 2022-10-19 09:44:06 +0800 9) maven { f9d91040 (zxcheng 2022-10-19 09:44:06 +0800 10) url "https://mvn.mob.com/android" f9d91040 (zxcheng 2022-10-19 09:44:06 +0800 11) } 48dfea7e (Mitchell Dong 2022-10-09 16:45:35 +0800 12) google() ^b35db2f (cmf 2022-08-30 12:09:45 +0800 13) } ^b35db2f (cmf 2022-08-30 12:09:45 +0800 14) dependencies { a2e7d1c9 (Mitchell Dong 2022-10-10 11:02:05 +0800 15) classpath 'com.android.tools.build:gradle:4.1.3' 48dfea7e (Mitchell Dong 2022-10-09 16:45:35 +0800 16) classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3' f9d91040 (zxcheng 2022-10-19 09:44:06 +0800 17) // 2.注册MobSDK f9d91040 (zxcheng 2022-10-19 09:44:06 +0800 18) classpath "com.mob.sdk:MobSDK:2018.0319.1724"