build last two commits

This commit is contained in:
2026-03-24 10:11:20 -07:00
parent ff9eb09838
commit 21e3dca187
278 changed files with 3912 additions and 3366 deletions

View File

@ -623,6 +623,8 @@ a:active {
a.ha,
span.ha-placeholder {
color: var(--color-pink);
font-size: .8em;
vertical-align: .1em;
}
span.ha-placeholder {
opacity: .55;
@ -1519,12 +1521,12 @@ export { HeadingAnchors }</script>
<p>this walkthrough also focuses on the &quot;happy path,&quot; without much discussion of troubleshooting. I may write more on the topic in the future, but we're already over <em>4,500 words</em>, so we're calling it a day.</p>
<p>finally, I wrote this walkthrough primarily with knowledge from using <strong>WSL</strong> [more on this later] on <strong>Windows</strong> and with <strong>Zed</strong> as my text editor. While I've tried to cover my bases with other OSes and options, there's a solid chance I'm missing things!</p>
<p>that all said, let's get (git?) into it!</p>
<h2 id="what-is-git">what is git?</h2>
<h2 id="what-is-git">what is <code>git</code>?</h2>
<p><code>git</code> is a <em>version control system</em>. We can use it to track changes we make to a set of files.</p>
<blockquote>
<p>tip: it's important to understand that despite the examples of MS Office and Google Docs above, <code>git</code> <em>isn't useful</em> with word documents. <code>git</code> shines with plain text files - .txt, .md, or basically any type of code.</p>
</blockquote>
<h3 id="where-can-i-use-git">where can I use git?</h3>
<h3 id="where-can-i-use-git">where can I use <code>git</code>?</h3>
<p>many, many tools interact with <code>git</code>:</p>
<ul>
<li>a lot of modern text editors have graphical user interfaces (GUIs) that let you perform <code>git</code> operations, like <a href="https://code.visualstudio.com/docs/sourcecontrol/overview" target="_blank" rel="external">VSCode</a>, <a href="https://zed.dev/docs/git" :target="_blank">Zed</a>, or <a href="https://www.sublimetext.com/docs/git_integration.html" :target="_blank">Sublime Text</a></li>
@ -1534,7 +1536,7 @@ export { HeadingAnchors }</script>
<p>today we're going to talk about the <code>git</code> CLI... technically. But <strong>don't let that scare you</strong> - we'll talk about <em>concepts</em> and <em>actions</em> that can be applied to other <code>git</code> interfaces as well.</p>
<h4 id="what-is-a-cli">what is a CLI?</h4>
<p>a CLI a way to interact with your computer and with software in text-only form. Rather than using the mouse and clicking on things, you type in commands and see output.</p>
<h3 id="where-can-i-use-the-git-cli">where can I use the git CLI?</h3>
<h3 id="where-can-i-use-the-git-cli">where can I use the <code>git</code> CLI?</h3>
<p>if you want to use the <code>git</code> CLI, you'll need a terminal. You've got a couple options here:</p>
<ul>
<li>on Linux or Mac, you should have one built in! This is the easy path, congrats :) Even better, <code>git</code> generally ships with these systems, so there's no installation required. Search for an application called 'Terminal' or similar
@ -1550,7 +1552,7 @@ export { HeadingAnchors }</script>
</li>
<li>both of the Windows options listed work with <a href="https://apps.microsoft.com/detail/9n0dx20hk701" target="_blank" rel="external">Windows Terminal</a> which offers a nicer-looking terminal experience than the basic command prompt. If you're going to keep working with what you set up today, I recommend it!</li>
</ul>
<h4 id="git-for-windows">git for Windows</h4>
<h4 id="git-for-windows"><code>git</code> for Windows</h4>
<p>on the &quot;Releases&quot; page, scroll down to &quot;Assets&quot; and pick the <code>.exe</code> file.</p>
<p>during installation, you'll be asked to choose some things by the installer. Here's my recommendations:</p>
<ol>
@ -1594,7 +1596,7 @@ export { HeadingAnchors }</script>
<h4 id="edit-files">edit files</h4>
<p>we'll want to edit files, right? How do we open our editor from the terminal?</p>
<p>there's usually a terminal command for the editor. For VSCode, it's <code>code</code>; for Zed, it's <code>zed</code>. If we want to open the <em>current directory</em> in our editor of choice (and we do!), we'll write <code>&lt;editor command&gt; .</code> (note the <code>.</code>), where <code>.</code> means &quot;the current directory.&quot;</p>
<h2 id="git-version">git version</h2>
<h2 id="git-version"><code>git version</code></h2>
<p>let's check that you have git installed with <code>git version</code>. You might see something like <code>git version 2.34.1</code> printed out in response. If you don't get a version number, but instead get an error saying you don't have <code>git</code>, <a href="https://git-scm.com/install" target="_blank" rel="external">install <code>git</code></a>.</p>
<h3 id="a-few-handy-settings">a few handy settings</h3>
<p>before we really start, we're going to set a few basics to make it easier for ourselves.</p>
@ -1622,8 +1624,8 @@ export { HeadingAnchors }</script>
<span class="token comment"># if we don't set this, git will prompt us to set it later</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> user.name <span class="token operator">&lt;</span>your-name<span class="token operator">></span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> user.email <span class="token operator">&lt;</span>your-email<span class="token operator">></span></code></pre>
<h2 id="git-going">git going</h2>
<p>(no, that's not a real <code>git</code> command)</p>
<h2 id="git-going"><code>git</code> going</h2>
<p>(no, that's not a real <code>git</code> command.)</p>
<p>there's two main ways to start:</p>
<ol>
<li>create a new project on our local machine, or</li>
@ -1632,14 +1634,14 @@ export { HeadingAnchors }</script>
<blockquote>
<p>tip: <code>git</code> and associated tooling refer to projects as <strong>repositories</strong>. I'll be sticking with the word project here as I find it a bit friendlier, but you'll probably run across the word repository in the wider world of <code>git</code></p>
</blockquote>
<h3 id="git-init">git init</h3>
<h3 id="git-init"><code>git init</code></h3>
<p><code>git init &lt;project&gt;</code> will create a new directory named <code>project</code> ready to be used with git. We can then use <code>cd &lt;project&gt;</code> to enter the directory.</p>
<blockquote>
<p>tip: don't use spaces in your project name!</p>
</blockquote>
<h3 id="git-clone">git clone</h3>
<h3 id="git-clone"><code>git clone</code></h3>
<p><code>git clone &lt;project URL&gt;</code> will pull in an existing project. We're not going to talk about this right now; instead, we're going forward assuming with <code>git init</code>.</p>
<h2 id="git-status">git status</h2>
<h2 id="git-status"><code>git status</code></h2>
<p>before we do anything, let's see what <code>git</code> will tell us about our project. Type <code>git status</code> and we might see the following:</p>
<pre class="language-txt"><code class="language-txt">On branch main
@ -1653,7 +1655,7 @@ nothing to commit (create/copy files and use "git add" to track)</code></pre>
<p>&quot;no commits&quot; means that the project has no history whatsoever. &quot;Nothing to commit&quot; means we've made no changes. But what is a commit?</p>
<h2 id="commits-and-history">commits and history</h2>
<p>a <strong>commit</strong> is one set of changes made to our work. We get to choose which changes are part of any given commit, and we write a message describing the commit so that future-us knows what we did if for some reason we need to undo something.</p>
<h3 id="git-log">git log</h3>
<h3 id="git-log"><code>git log</code></h3>
<p>in an established project, we can use <code>git log</code> to look at our <strong>commit history</strong>. By default, one commit will output like this:</p>
<pre class="language-txt"><code class="language-txt">commit e2fd6c4772e61f9c074638a933eb92fc1ea885ef
Author: Lee Cattarin &lt;lee.cattarin@gmail.com>
@ -1690,7 +1692,7 @@ Date: Sun Dec 28 18:47:00 2025 -0800
(use "git rm --cached &lt;file>..." to unstage)
new file: file.txt</code></pre>
<p><em>now</em> we're ready to create a commit!</p>
<h2 id="git-commit">git commit</h2>
<h2 id="git-commit"><code>git commit</code></h2>
<p>if we just write <code>git commit</code>, it'll open an editor for us to edit the <strong>commit message</strong> - our description of the changes. This can be handy if we want to write a lengthy description, but if we want to just write a one-liner, we can use <code>git commit -m &quot;&lt;message&gt;&quot;</code>. It's quicker and doesn't involve opening an editor.</p>
<p>let's create a super basic commit:</p>
<pre class="language-sh"><code class="language-sh"><span class="token function">git</span> commit <span class="token parameter variable">-m</span> <span class="token string">"baby's first commit"</span></code></pre>
@ -1718,13 +1720,13 @@ nothing to commit, working tree clean</code></pre>
(use "git add &lt;file>..." to update what will be committed)
(use "git restore &lt;file>..." to discard changes in working directory)
modified: file.txt</code></pre>
<h3 id="git-restore">git restore</h3>
<h3 id="git-restore"><code>git restore</code></h3>
<p><code>git restore</code> is new! That lets us get rid of our changes and go back to the last version of the file committed. Be careful with this - we should only do it if we <em>really</em> want to get rid of those changes.</p>
<p>let's not restore, and instead stage and commit our new changes:</p>
<pre class="language-sh"><code class="language-sh"><span class="token function">git</span> <span class="token function">add</span> file.txt
<span class="token function">git</span> commit <span class="token parameter variable">-m</span> <span class="token string">"added a new sentence"</span></code></pre>
<p>again, we can use <code>git status</code> or <code>git log</code> as needed.</p>
<h2 id="git-revert">git revert</h2>
<h2 id="git-revert"><code>git revert</code></h2>
<p>ooooh... I don't actually like that change. What if I want to undo something?</p>
<p>run <code>git log</code> again, and copy the first 6-8 characters in the commit string (we can copy more, including the whole string if we want, but it's not necessary):</p>
<pre><code>commit 8b5dd7838f8c8423cfa445b6cddbed88e9c32511 (HEAD -&gt; main)
@ -1738,7 +1740,7 @@ Date: Wed Jan 7 15:18:45 2026 -0800
<pre class="language-txt"><code class="language-txt">[main 9268d5c] Revert "added a new sentence"
1 file changed, 1 deletion(-)</code></pre>
<p>I didn't edit the message - we can tell because it just says &quot;Revert&quot; and then the old commit message. But we can edit and add lots of detail about why we're doing it.</p>
<h2 id="git-remote">git remote</h2>
<h2 id="git-remote"><code>git remote</code></h2>
<p>let's try a new command: <code>git remote</code>. Hmm, nothing happened... what's a &quot;remote&quot;?</p>
<p>remember how I said we could use <code>git clone</code> to work on an existing project? If we did that, we'd be getting that project from a <em>remote</em> server - not our <em>local</em> machine.</p>
<p>the world of git servers is vast - hell, you can run your own! - but we're going to just mention a few major hosts: GitHub, GitLab, and Codeberg. For this walkthrough, we're going to work with Codeberg, but you'll find that the UI is pretty similar across all three, so if you've got a GitHub or GitLab account feel free to use that.</p>
@ -1757,13 +1759,13 @@ Date: Wed Jan 7 15:18:45 2026 -0800
<pre class="language-txt"><code class="language-txt">codeberg https://codeberg.org/inherentlee/git-intro.git (fetch)
codeberg https://codeberg.org/inherentlee/git-intro.git (push)</code></pre>
<p>cool! we have a remote set up. What does &quot;fetch&quot; and &quot;push&quot; mean?</p>
<h3 id="git-fetch-and-git-pull">git fetch (and git pull)</h3>
<h3 id="git-fetch-and-git-pull"><code>git fetch</code> (and <code>git pull</code>)</h3>
<p><code>git fetch</code> brings <strong>remote</strong> changes to our local machine. So does a command called <code>git pull</code>. Why are there two?</p>
<p><code>fetch</code> brings the remote changes down, but <em>doesn't combine them yet with our local work</em>. This gives us a chance to explore what those changes are before we actually integrate them into our work!</p>
<p>this may seem unhelpful if we're thinking about this project as something only we work on, but imagine there's a team of people all contributing to the project. What if we <em>and</em> another person both work on the same file? Our changes might overlap!</p>
<p>if we're working alone and <em>from one machine</em>, we'll pretty much never have to use <code>git fetch</code> or <code>git pull</code>! If we happen to do our work on multiple machines - for example, I do some work on my PC and some on my fruitpad (using an app called <a href="https://workingcopy.app/" target="_blank" rel="external">Working Copy</a>) - we'll probably update the remote from one machine, then need to pull that work down onto the other machine.</p>
<p>for our use case, we can pretty safely stick to <code>git pull</code> (if we ever even need to use it!), but if you're working in a larger collaborative project, <code>git fetch</code> is your friend!</p>
<h3 id="git-push-take-one">git push, take one</h3>
<h3 id="git-push-take-one"><code>git push</code>, take one</h3>
<p><code>git push</code> is the opposite of <code>git pull</code> - it takes your local changes and adds them to the remote.</p>
<p>the first time we use it on any given branch, we'll want to set what's called the <strong>upstream</strong> - the remote branch that our local branch is connected to by default. We can do this with the following command:</p>
<pre class="language-sh"><code class="language-sh"><span class="token function">git</span> push --set-upstream codeberg main
@ -1821,7 +1823,7 @@ codeberg https://codeberg.org/inherentlee/git-intro.git (push)</code></pre>
<pre class="language-sh"><code class="language-sh"><span class="token function">git</span> remote set-url codeberg <span class="token operator">&lt;</span>new-url<span class="token operator">></span></code></pre>
<p>we'll notice that the SSH URL starts with <code>git@</code>, whereas the HTTPS URL started with <code>https://</code>.</p>
<p>in order for all this to be useful, we need to tell Codeberg about our SSH key. In Codeberg, navigate to <a href="https://codeberg.org/user/settings/keys" target="_blank" rel="external">settings, then find the left-hand tab for SSH keys</a>. Choose 'Add key' and paste in the <strong>public</strong> key (if you set up that <code>sshcat</code> alias, use it now to output your key for ease of copying). Save and we'll now be set up to authenticate with SSH!</p>
<h3 id="git-push-take-two">git push, take two</h3>
<h3 id="git-push-take-two"><code>git push</code>, take two</h3>
<p>we can now call <code>git push</code> again and again now without having to repeat our credentials every time. We can also call <code>git pull</code> for our private repositories.</p>
<h2 id="summary">summary</h2>
<p>let's talk about what we've done.</p>
@ -1881,25 +1883,11 @@ codeberg https://codeberg.org/inherentlee/git-intro.git (push)</code></pre>
<ol id="postlist">
<li class="post">
<a class="postlink" href="/redirections/">
<a class="postlink" href="/moving-images/">
<img src="/img/angle-brackets-uwu.jpg" alt="Ascii art of an emoticon with pinched eyes and a small mouth made with two angle brackets." loading="lazy" decoding="async" width="1000" height="316">
<img src="/img/cormorant.jpg" alt="Image unrelated to post. A cormorant, a type of black waterfowl, poses with wings spread on a buoy in Puget Sound. Off to the left, another bird floats." loading="lazy" decoding="async" width="1000" height="666">
<h2 data-ha-exclude="" id="redirections">redirections</h2>
<ul class="postlist-tags">
<li>software</li>
</ul>
</a>
</li>
<li class="post">
<a class="postlink" href="/eleventy-lessons/">
<img src="/img/hellebore.jpg" alt="Image unrelated to post. Close up on a pale green hellebore flower." loading="lazy" decoding="async" width="1000" height="666">
<h2 data-ha-exclude="" id="eleventy-lessons">eleventy lessons</h2>
<h2 data-ha-exclude="" id="moving-images">moving images</h2>
<ul class="postlist-tags">
<li>software</li>
@ -1922,6 +1910,20 @@ codeberg https://codeberg.org/inherentlee/git-intro.git (push)</code></pre>
</a>
</li>
<li class="post">
<a class="postlink" href="/eleventy-lessons/">
<img src="/img/hellebore.jpg" alt="Image unrelated to post. Close up on a pale green hellebore flower." loading="lazy" decoding="async" width="1000" height="666">
<h2 data-ha-exclude="" id="eleventy-lessons">eleventy lessons</h2>
<ul class="postlist-tags">
<li>software</li>
</ul>
</a>
</li>
</ol>
</section>
@ -1953,6 +1955,6 @@ codeberg https://codeberg.org/inherentlee/git-intro.git (push)</code></pre>
</footer>
<!-- This page `/an-intro-to-git/` was built on 2026-03-24T16:54:11.078Z -->
<!-- This page `/an-intro-to-git/` was built on 2026-03-24T17:11:02.666Z -->
</body>
</html>