Referencing the child of a commit in Git

后端 未结 10 1124
失恋的感觉
失恋的感觉 2020-11-28 08:37

If you want to move the HEAD to the parent of the current HEAD, that\'s easy:

git reset --hard HEAD^

But is there

10条回答
  •  情歌与酒
    2020-11-28 09:07

    Based on the answer given in How do I find the next commit in git?, I have another solution that works for me.

    Assuming that you want to find the next revision on the "master" branch, then you can do:

    git log --reverse ${commit}..master | sed 's/commit //; q'
    

    This also assumes that there is one next revision, but that is kind of assumed by the question anyway.

提交回复
热议问题