I am working my way through this book Mastering React Test-Driven Development
.
The code for this book is available here https://github.com/PacktPublishing/Mastering-React-Test-Driven-Development-Second-Edition
I want to be able to browse through each of the commits in the appointments branch starting from the first commit and move through them sequentially to see how the author has done atomic commits to study the changes done in each commit.
I am not that well-versed in Git yet. I have gone through a few books and some online tutorials, but I am still not clear how to achieve this objective. I use VSCode and using GitLens, doing a number of clicks, I am able to achieve this, but I want an easier way to do this.
Here is the appointment branch from its oldest commit: https://github.com/PacktPublishing/Mastering-React-Test-Driven-Development-Second-Edition/commits/appointments?after=c2c89df049f1a34b8435d2cf87d7522bdebb9f0d+69&branch=appointments&path%5B%5D=appointments&qualified_name=refs%2Fheads%2Fappointments
Here if I click on the second commit `Add react and babel packages' then I get to see the changes done in that commit. https://github.com/PacktPublishing/Mastering-React-Test-Driven-Development-Second-Edition/commit/60899470fc35ec0c67开发者_开发问答b8cf87d35e77c8c099755c
I want something similar to be done in Command Line (preferably so that it would help me to learn to use Git better) or in VSCode.
I have gone through this thread and tried experimenting with the answer given, but I still could not reach my desired objective - any help would be appreciated. How to move through git commits
This may not be an answer to your question, just my understanding that can contribute to the answer.
@torek says in an answer
Git can only go backwards, not forwards. The workaround for this is simple: go backwards.
Going backward is easy because the previous (parent) commit(s) are already recorded in the commit object. However, to find the next commit (going forward) you have to scan all commits to find all child commits that has that commit as a parent.
That said, it is not impossible. You can use git blame --reverse
or git log --reverse
.
Moving through non-linear commit history (merges, branches) is another challenge for either direction.
精彩评论