How can I jump to the first every commit in a git repository? Also, is there a way to do it on Github through the website?
If you want to go to a particular commit of a git repository with submodules you can use 2 git commands: reset or checkout. You will also need to synchronise the submodules after the working directory has been altered as that doesn't happen automatically.
Click on the "Insights" tab of the repository that you want to see the oldest commit, followed by the "Network" sub-tab on the left menu bar. When the page is fully loaded (i.e. you can see lots of lines joining and all), press Shift + ← to go all the way to the first commit.
To squash the commits use git rebase to do an interactive rebase. For the example above where the last two commits have the same Change-ID this means an interactive rebase for the last two commits should be done. For further details about the git rebase command please check the Git documentation for rebase.
To go the first commit of the repo, do
git checkout master
git log --reverse
git checkout <SHA-1>
, where is the SHA of the commit(first one)
Also, when you do git log
you can easily navigate to the last entry to see the first commit.All this can also be done in single command like git checkout `git rev-list --max-parents=0 HEAD | tail -n 1`
which means to switch to the last commit having no parent from the current HEAD
Note: if you used --depth
option, you might not be able to see the actual first commit, to avoid this ensure you clone the full repo (without --depth
option)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With