Added information on checking out earlier commits

This commit is contained in:
Kenneth John Odle 2025-01-25 15:58:54 -05:00
parent d80ee23ae1
commit 79e9d5e698
3 changed files with 20 additions and 1 deletions

View File

@ -394,11 +394,24 @@ sends the output of that command to a file (\texttt{log.txt}), the first few lin
2025-01-24 0d9e1fe Kenneth Odle Added information about workflows
2025-01-22 d37d470 Kenneth Odle Added inline to-do items
2025-01-22 02d4025 Kenneth Odle Updated changelog, version number
2025-01-22 43e59f7 Kenneth Odle Significant addtions to branching chapter
2025-01-22 43e59f7 Kenneth Odle Significant additions to branching chapter
\end{Verbatim}
Here we get the date of the commit (in YYYY-MM-DD format), followed by an abbreviated commit hash, the name of the comitter (important if you have more than one person working on this project), and finally the commit description.
\section{Examinging Earlier Commits}
Now that you know how to find earlier commits, you need to know how to revert to one. To do that, you simply \texttt{checkout} the earlier commit, using just enough of the SHA-1 hash to be identifiable:
\input{include/gitcheckoutcommit}
In this case, this would take me back to the ``Significant additions to branching chapter'' commit.
To get back to the latest commit, we simply checkout our current branch, which in this case is ``main'':
\input{include/gitcheckoutmain}
Of course, the easiest way to view older commits and examine them is by using a \textit{remote} repository, because their graphical interface is far easier to navigate.
\chapter{Remote Repositories}

View File

@ -0,0 +1,3 @@
\begin{Verbatim}[]
$ git checkout 43e59f7
\end{Verbatim}

View File

@ -0,0 +1,3 @@
\begin{Verbatim}[]
$ git checkout main
\end{Verbatim}