AHMED EL-HAROUNY
AHMED EL-HAROUNY

Reputation: 836

Git history starting from a specific commit up to the last commit

I know I can use the following command to get commit history starting from this specific commit to the first commit in history (going backwards).

git log --pretty=format:"%h - %an, %ar : %s" "de37b49d8f06321275079e6b3a3f00aa22bbff99"

However, how to reverse this to display history starting from this specific commit -including it- up to the last commit in history (going upwards)?

Thanks

Upvotes: 0

Views: 52

Answers (1)

Andrew C
Andrew C

Reputation: 14823

Presuming de37b49 isn't a merge commit you would do

git log --pretty=format:"%h - %an, %ar : %s" de37b49~1..HEAD

which is saying "NOT reachable by parent of de37b49" but "reachable by HEAD"

If that is a merge commit, then you would need to use

git log ... ^de37b49^1 ^de37b49^2 HEAD

(for as many parents it has, presuming 2)

Upvotes: 1

Related Questions