Added «git workflow» chapter
This commit is contained in:
parent
333706b9cf
commit
a1cf982ada
@ -384,6 +384,63 @@ Dependency hell is suppposed to be a thing of the past, so I'm not quite sure wh
|
|||||||
It's possible that the snap was configured wrong. It's also possible that I borked\footnote{I.e., I misconfigured or broke something.} something without realizing it when I was doing something else. (I do have a tendency to tinker with things under the hood.) Unlike the days of old I did not have to spend hours or days trying to figure this out. A couple of quick web searches got me up and running again.
|
It's possible that the snap was configured wrong. It's also possible that I borked\footnote{I.e., I misconfigured or broke something.} something without realizing it when I was doing something else. (I do have a tendency to tinker with things under the hood.) Unlike the days of old I did not have to spend hours or days trying to figure this out. A couple of quick web searches got me up and running again.
|
||||||
|
|
||||||
|
|
||||||
|
\chapter{A \texttt{git} Workflow}
|
||||||
|
|
||||||
|
\lettrine[lines=2, loversize=0.2, findent=2mm, nindent=1mm, image=true]{git-icon}{} \texttt{git} is version control software. That is, it allows you to record and track changes to a set of files over time. You can then compare different revisions or even revert some files or the entire project back to a previous version.
|
||||||
|
|
||||||
|
What I'm going to do here is describe how I understand and use \texttt{git}. I am far from a power-user or expert in \texttt{git}, so I may get some things wrong. Please let me know if I do, or if you want clarification on some things. (My email address is on page 40.)
|
||||||
|
|
||||||
|
\section{What \texttt{git} Can Do For You}
|
||||||
|
|
||||||
|
\texttt{git} is great if you are a software developer, because as you work you make a \textit{lot} of changes to your code. It's also great if you are a writer, because you can work with complete confidence that you can experiment as much as you want and not have to worry about losing or overwriting something. You can also revert to an earlier version, or \textit{branch} in order to experiment. But more about that later.
|
||||||
|
|
||||||
|
\texttt{git} works best with text-based files—basically, anything that has a .txt, .html, .css, .php, etc. extension will work. There's no reason that you can't add binaries, such as images, pdfs, Microsoft Word fles, or LibreOffice files. (I'm writing this zine in \LaTeX{}, and do include a few images in most issues, for example.) The issue is that because they are binaries, \texttt{git} won't be able to tell you the difference between versions. (I would add, though, that if you are writing, you really should separate out the content and the styling from the beginning, so that you can focus on the story you want to tell.)
|
||||||
|
|
||||||
|
\section{\texttt{git} Concepts}
|
||||||
|
|
||||||
|
If you are just starting out with \texttt{git} you'll make faster progress if you understand some of the basic concepts. If you are coming to \texttt{git} from a different version-control software, then some or all of these concepts will be familiar to you, although they will probably have different names. Keep in mind that all of these technologies work differently, so you may have to retrain your brain to follow a different workflow.
|
||||||
|
|
||||||
|
\paragraph{Concept One: \texttt{git} exists in both time and space.} This is true of just about all version control software, or at least all the different types I am aware of.
|
||||||
|
|
||||||
|
\paragraph{Concept Two: The basic time unit of \texttt{git} is a \textit{commit}.} A commit is simply a snapshot of where your project stands at any given moment. When you make a commit, it's like taking a picture of your project at that particular moment.
|
||||||
|
|
||||||
|
\paragraph{Concept Three: The basic space unit of \texttt{git} is a \textit{repository}.} All those commmits have to live somewhere, and a repository is just a place where all those commits exist. Repositories (or \textit{repos} for short) can be \textit{local}—that is, they exist on your computer only—or they can be \textit{remote}—meaning that can live on other computers somewhere else. That ``somewhere else'' is usually a publicly available server. You can create your own\footnote{You can see mine at \kref{https://git.kjodle.net/}{https://git.kjodle.net/}, for example.} or you can get an account at someplace like Gitlab\footnote{\kref{https://gitlab.com/}{https://gitlab.com/}} which is for-profit and wants your money, or Github\footnote{\kref{https://github.com/}{https://github.com/}} which is now owned by Microsoft and wants your soul.
|
||||||
|
|
||||||
|
You can work with a local repository only, or you can decide to work with one or more remote repositories. The choice is up to you.
|
||||||
|
|
||||||
|
\paragraph{Concept Four: Repositories are multi-dimensional.} If you make a series of commits to a repository, it will be linear in nature. This is perfectly ordinary. But you may get to a point where you want to experiment with a change and you're not sure whether you'll like the new version or the old version better. Rather than commit that new version, which overrides the original version, you can \textit{branch} and have both versions existing at the same time. A branch is basically a copy of a repository at this point in time (i.e., from the last commit). You can then switch between branches and test things out.
|
||||||
|
|
||||||
|
If you like the changes you have in the branch, you can then \textit{merge} them into your main branch. If you don't like them, you have a choice. If, on the one hand, you want to keep them around (in case you change your mind later, or as an example of what \textit{not} to do) you can just return to your main branch and continue working there. That experimental branch will still be hanging out there, existing in our space, but in a parallel dimenstion. If, on the other hand, you want to forget that you ever did that, you can return to your main branch and then delete it entirely. It will be like it never existed.\footnote{If only we could get a version of \texttt{git} that would manage our actual lives, this would be great. Until then, we will go on making bad decisions.}
|
||||||
|
|
||||||
|
\section{Installing \texttt{git}}
|
||||||
|
|
||||||
|
I really dislike writing about how to install things, because 1) space in this zine is limited, 2) methods are subject to change over time, and 3) those instructions are usually available at the other end of a web search. But I love \texttt{git} and want to encourage as many people as might be helped by it to use it, so here we go.
|
||||||
|
|
||||||
|
If you are using some version of Linux, chances are pretty good that git is already pre-installed on your system. If you're not sure whether it is or not, you can always open a terminal and type \texttt{git --version}. You'll either get the version that is currently installed on your system, or a message like ``command not found'', meaning that it isn't installed on your system.
|
||||||
|
|
||||||
|
\subsection{On Linux}
|
||||||
|
|
||||||
|
If you have confirmed that \texttt{git} is not installed on your system, here are some options:
|
||||||
|
|
||||||
|
For Fedora-type systems, use \texttt{dnf}:
|
||||||
|
|
||||||
|
\input{include/fedgitinstall}
|
||||||
|
|
||||||
|
For Debian-type systems, use \texttt{apt}:
|
||||||
|
|
||||||
|
\input{include/debgitinstall}
|
||||||
|
|
||||||
|
\subsection{On Windows and macOS}
|
||||||
|
|
||||||
|
I simply have no idea. I don't use Windows except at work.\footnote{The last version of Windows that I used in real life was Windows 7. I loved that version of Windows and got a lot of work done on it. But Windows 10 is ugly and clunky and mostly spyware. Windows 11 is ugly and entirely spyware.} I also don't have access to a secure macOS install, so I can't experiment. But instructions are available on the web. Start with \kref{https://git-scm.com/book/en/v2/Getting-Started-Installing-Git}{https://git-scm.com/book/en/v\\2/Getting-Started-Installing-Git}.
|
||||||
|
|
||||||
|
\subsection{\texttt{git} Clients}
|
||||||
|
|
||||||
|
\texttt{git} is a command line based technology. Yes, there are GUIs out there for \texttt{git}, and if you are on Windows or macOS, you may find them useful. You can see a fairly comprehensive list at \kref{https://git-scm.com/book/en/v2/Getting-Started-Installing-Git}{https://git-scm.com/book/en/v2/G\\etting-Started-Installing-Git}.
|
||||||
|
|
||||||
|
In general, I advise against using any type of GUI. For one thing, \texttt{git} is fairly easy to manage from the command line, so using a GUI just adds a level of abstraction that we don't really need. For another, the command line is forever, but GUIs come and go. If your GUI gets to a point where it's development is discontinued, or it decides to adopt a subscription model that you can't afford, you're screwed.
|
||||||
|
|
||||||
|
|
||||||
\chapter{Easy Outlines in \LaTeX{}}
|
\chapter{Easy Outlines in \LaTeX{}}
|
||||||
|
|
||||||
Ever since I first learned about outlining in high school (or was it earlier?) I've always loved being able to organize information hierarchically. The irony is that I also love biology and the natural world does not necessarily organize itself in a hierarchical way. Cross-pollination and inter-species breeding is a thing.
|
Ever since I first learned about outlining in high school (or was it earlier?) I've always loved being able to organize information hierarchically. The irony is that I also love biology and the natural world does not necessarily organize itself in a hierarchical way. Cross-pollination and inter-species breeding is a thing.
|
||||||
|
BIN
005/images/git-icon.eps
Normal file
BIN
005/images/git-icon.eps
Normal file
Binary file not shown.
3
005/include/debgitinstall.tex
Normal file
3
005/include/debgitinstall.tex
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
\begin{Verbatim}[]
|
||||||
|
$ sudo apt install git-all
|
||||||
|
\end{Verbatim}
|
3
005/include/fedgitinstall.tex
Normal file
3
005/include/fedgitinstall.tex
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
\begin{Verbatim}[]
|
||||||
|
$ sudo dnf install git-all
|
||||||
|
\end{Verbatim}
|
Loading…
Reference in New Issue
Block a user