What is the opposite of `git diff HEAD^`?

前端 未结 3 1343
死守一世寂寞
死守一世寂寞 2021-02-03 22:57

In git, I can specify the previous revision by saying HEAD^ or HEAD~1. What about going the other way? Suppose I\'m on revision X, and I do git c

3条回答
  •  忘了有多久
    2021-02-03 23:56

    I don't think this is possible, since a Git commit only stores its parent commit, but not its children.

    Imagine a commit would store its children. What would happen if you would create several branches off this commit, so multiple commits have this commit as parent? What would then be "HEAD+"? This is ambiguous and wrong.

    Speaking in what I know from data structures: Git stores history as a single-linked list, whereas you operation would need a doubly-linked list.

提交回复
热议问题