2011-12-14 58 views

回答

2

是的,它是可能的。

这里的总体规划:

  1. 获取所有叼着提交列表。
  2. 对于每个提交晃来晃去,做一个git的日志,看看祖先是存在的。

shell脚本:

particular_ancestor_hash=<40 character hash> 
for commit in `git fsck --unreachable|grep 'unreachable commit'|awk '{print $3}'`; do 
    if git log --format='%H' $commit|grep -q $particular_ancestor_hash; then 
     echo $commit 
    fi 
done