多個 team 一起開發一個項目,會碰到“踢皮球”的事情,如果能找到commit id 來證明是誰改的,那就是最好的證據了。
先進到修改過的git 目錄下,通過以下命令,可以找出有此修改的commit id:
git rev-list --all | xargs git grep -F 'your_search_string' > a.txt
然後從最後一個commit id開始執行:
git diff commit_id
查看是否有修改的code,如果沒有就查看上一個,直到找到位置。根據經驗,一般一兩個就能找到修改的 commit id。
到這裡就知道是誰改的出了問題,再然後列出詳細的 commit 信息:
git show commit_id
到這裡就可以將 Bug 轉出去了。
另外,如果在git log 導出來,用 BC工具進行比較,也能將修改的地方快速找出來。這裡不作詳述。
//20180721 补充:
以下这条命令可以只查看 commit_id 中修改的文件
git show commit_id file
以下命令在 repo init 裡指定了 --depth=1, 這告訴了接下來的 repo sync 指令, 我們只要下載 repo init 命令中所指定分支的最後一版資料.
執行 git fetch --unshallow 命令, 還是可以將所有的版本下載下來.
repo init -u git://review.xx.com/platform/manifest -b branch_name --depth=1
repo sync kernel-8.10;date
git fetch --unshallow
[end_by_ChampWang]