使用git_blame定位修改代码历史

使用git blame定位修改代码历史

git blame定义

git-blame - Show what revision and author last modified each line of a file

文档地址: https://git-scm.com/docs/git-blame

查看整个文件修改历史

git blame file

显示格式为: commit id + author + commit date

$ git blame src/main/java/com/github/***/cpone/MyThread.java
0a497a6e (m***e 2018-12-09 10:57:05 +0800  1) package com.github.white.cpone;
0a497a6e (m***e 2018-12-09 10:57:05 +0800  2)
0a497a6e (m***e 2018-12-09 10:57:05 +0800  3) public class MyThread extends Thread {
0a497a6e (m***e 2018-12-09 10:57:05 +0800  4)
0a497a6e (m***e 2018-12-09 10:57:05 +0800  5)

查看文件中某个代码段修改历史

git blame -L start,end file

$ git blame -L 22,28 src/main/java/com/github/***/cpone/MyThread.java
f5b5b4b4 (m***e 2018-12-09 14:43:29 +0800 23)             System.out.println("进程catch中...");
f5b5b4b4 (m***e 2018-12-09 14:43:29 +0800 25)             System.out.println("catch...");
0a497a6e (m***e 2018-12-09 10:57:05 +0800 26)             Thread.currentThread().interrupt();

猜你喜欢

转载自blog.csdn.net/u013887008/article/details/84928165
今日推荐