Updates to chapter 4

This commit is contained in:
Kenneth John Odle 2025-01-26 16:01:36 -05:00
parent fb947caf90
commit 25311b0973

View File

@ -566,7 +566,7 @@ This is the point where you can experiment and have fun on this branch without w
It's always a good idea to clean up after ourselves. If we don't need that experimental branch any more, we can delete it with \texttt{git branch -d <branchname>}.
In reality, things are rarely going to be this simple, unless you are only making very basic changes to a branch. You'll possibly get all sorts of error messages or warning messages, and will get confused or even scared. The nice thing about Git is that most of the solutions you need are easily found at the other end of a web search by looking up the error message you received.
In reality, things are rarely going to be this simple, unless you are only making very basic changes to a branch. You'll possibly get all sorts of error messages or warning messages, and may get confused or even scared. Unfortunately, dealing with those error messages is beyond the scope of this document, but the nice thing about Git is that most of the solutions you need are easily found on the web.
\section{A Basic Branching Example}
@ -584,7 +584,7 @@ Let's go ahead and commit those using the following set of commands:
Notice that we don't have a remote repository at this point, so all we are doing is making commits. Running \texttt{git status} gives us this output:
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{}]
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Output from git status}]
On branch main
nothing to commit, working tree clean
\end{Verbatim}
@ -599,7 +599,7 @@ Git immediately gives us this message:
Switched to a new branch 'testbranch'
\end{Verbatim}
Now we're going to add a new line to \texttt{doc\a.txt} so it looks like this:
Now we're going to add a new line to \texttt{doc\_a.txt} so it looks like this:
\label{doc-aC2}
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{doc\_a.txt New Contents}]
@ -610,7 +610,7 @@ This is line B1.
Now if we run \texttt{git status}, we'll see this:
\begin{Verbatim}[]
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Output of git status with Changes to Project}]
On branch testbranch
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
@ -637,7 +637,7 @@ index ea9c135..01b52bf 100644
+This is line A3.
\end{Verbatim}
In most terminals, this output will be color-coded, which is helpful on the fly, but we have line numbers here to help us. Let's take this line by line to understand what Git is telling us.
In most terminals, this output will be color-coded, which is helpful on the fly, but I've added line numbers here to help us. Let's take this line by line to understand what Git is telling us.
\begin{itemize}
@ -672,7 +672,7 @@ index 01b52bf..505be23 100644
This is line A3.
\end{Verbatim}
This is similar to before, but now we are seeing that line 6 now has a minus sign in front of it, because that line only exists in the original version of that file. But it doesn't show us any information about \texttt{doc\_b.txt} because file is completely new.
This is similar to before, but now we are seeing that line 6 now has a minus sign in front of it, because that line only exists in the original version of that file. But it doesn't show us any information about \texttt{doc\_b.txt} because that file is completely new.
How does this test branch compare to our main branch? First, let's add both files (\texttt{git add -A}) and make a commit (\texttt{git commit -m "commit message"}). Now we can ask Git to tell us the difference between these two branches using this command: