How do I find the next commit in Git? (child/children of ref)


ref^ refers to the commit before ref. What about getting the commit after ref?

For example, if I git checkout 12345, how do I check out the next commit?

Yes, Git's a DAG node pointer struct tree whatever. How do I find the commit after this one?


To list all the commits, starting from the current one, and then its child, and so on - basically standard git log, but going the other way in time, use something like

git log --reverse --ancestry-path 894e8b4e93d8f3^..master

where 894e8b4e93d8f3 is the first commit you want to show.

N.b. When using a DOS command prompt, you must escape the caret:

git log --reverse --ancestry-path 894e8b4e93d8f3^^..master

How to grep commits based on a certain string?

How do I properly force a Git push?