2014-10-31 70 views

回答

7

你想要排除父母提交和合並提交,然後看哪些人有與他們的父母相同的樹。

for sha in $(git rev-list --min-parents=1 --max-parents=1 --all) 
do 
    if [ $(git rev-parse ${sha}^{tree}) == $(git rev-parse ${sha}^1^{tree}) ] 
    then 
     echo "${sha} will be pruned" 
    fi 
done 
3

作爲第一個近似值,單子所有的提交和日誌具有相同的樹哈希作爲一個之前的任何行:

git log --all --reverse --format='%H %t' | while read h t; do 
    if [ "$lt" = "$t" ]; then 
    echo "$h" 
    fi 
    lt="$t" 
done 

你可以忽略任何與多個父提交和確認改善這種該日誌行實際上是之前的一個孩子。

相關問題