git
Block 1.2: History & Time-Travel
git log
We can see the history of our committed changes, called commits
using git log
.
git log
# commit ed226e022f60d9f578265c2c246367f5f07756de (HEAD -> main)
# Author: Jan Simson <git@simson.io>
# Date: Fri Sep 16 17:00:03 2022 +0200
# Edit hello.txt
# commit 795780d123f6eeedaa09734005c08d1ad89c1976
# Author: Jan Simson <git@simson.io>
# Date: Fri Sep 16 16:59:45 2022 +0200
# Adding hello.txt
# lines 1-9
You can move up and down with the arrow keys and leave the log view by pressing q
.
git checkout
Background: https://giphy.com/gifs/back-to-the-future-xsF1FSDbjguis
git checkout
You can go back to any previous commit (and many other things!) with git checkout
.
git reflog
Git tracks where your HEAD has been and what you do in your repository. This history can be seen via git reflog
.
git checkout
push
/ pull
)git clone https://github.com/jansim/git-murder-mystery.git
git log
to see the history of the repositorygit checkout
to go to the pastgit reflog
after you solved the caseAny Questions?