我需要为我的老师记录我所有的git提交。他给了我以下例子:
git log --pretty="%H" --author=you | while read commit_hash
do git show $commit_hash
done > log.txt
我知道"你"部分需要是我的名字,git命令工作正常,但在管道后它返回一个大于号,并没有做任何事情。我也明白它应该使用git show
命令的每个提交哈希。有什么建议?我也在使用OSX。
答案 0 :(得分:1)
VonC的回答在处理换行方面是正确的,但是你的初始方法比较复杂。您可以使用git log -p
代替git log
和git show
的组合:
git log -p --author=you > log.txt
答案 1 :(得分:0)
可能是因为你需要在下一行显示命令行继续的shell(尾随\
):
git log --pretty="%H" --author=you | while read commit_hash \
do git show $commit_hash \
done > log.tx
答案 2 :(得分:0)
您可以运行
,而不是使用while循环git log --author=you --patch --stat > log.txt