通过命令:
$git diff --name-status tag1 tag2 -- target-src
输出如下:
M src/config.h
M src/createTable.sql
A src/gameserver/BattleGround_10v10.h
M src/gameserver/CMakeLists.txt
M src/gameserver/achieve.cpp
M src/gameserver/achieve.h
A src/gameserver/action.cpp
A src/gameserver/action.h
A src/gameserver/activity.cpp
A src/gameserver/activity.h
M src/gameserver/admin.cpp
我得到了在两个标签之间修改的文件。但我想要按承诺时间排列的列表顺序。我怎样才能做到这一点?
感谢ilius 的回答,我添加awk
了我的请求:
git diff --name-status tag1 tag2 | while read line ; do
status=${line:0:1}
path=${line:2}
date=$(git log -1 '--pretty=format:%ci' -- "$path")
echo "$date $status $path"
done | sort -r | awk '{print $4" "$5}'
但是我觉得太复杂了。能不能简单点?