Getting a list of all children of a given commit

后端 未结 4 946

I\'d like to run git filter-branch on all children of a given commit. This doesn\'t seem to be an easy task, since there doesn\'t appear to be a way to tell

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 06:47

    I did a alternative version. I don't know if its better or worse.

    getGitChildren(){
        git rev-list --all --parents | grep "^.\{40\}.*${1}.*" | awk '{print $1}' | xargs -I commit git log -1 --oneline commit | cat -
    }
    

    to be used like that:

    $ getGitChildren 2e9df93
    f210105376 feat(something): did that feature
    9a1632ca04 fix(dummy): fix something
    

    It just give the direct children list of a commit.

提交回复
热议问题