<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>The Mandelbear&apos;s Musings</title>
  <link>https://mdlbear.dreamwidth.org/</link>
  <description>The Mandelbear&apos;s Musings - Dreamwidth Studios</description>
  <lastBuildDate>Fri, 07 Apr 2023 16:54:08 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>mdlbear</lj:journal>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/15740388/505737</url>
    <title>The Mandelbear&apos;s Musings</title>
    <link>https://mdlbear.dreamwidth.org/</link>
    <width>96</width>
    <height>96</height>
  </image>

<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1858611.html</guid>
  <pubDate>Fri, 07 Apr 2023 16:54:08 GMT</pubDate>
  <title>Happy Birthday to Git, and a signal boost</title>
  <link>https://mdlbear.dreamwidth.org/1858611.html</link>
  <description>&lt;p&gt; The &lt;a href=&quot;https://en.wikipedia.org/wiki/Git&quot;&gt;Git&lt;/a&gt; version-control
    system was released 18 years ago today, so it&apos;s old enough to vote in the
    US.  (The most recent version, 2.40.0, was released this year on
    &lt;em&gt;my&lt;/em&gt; birthday.  But I digress.)

&lt;p&gt; In related news, I&apos;d like to join &lt;a href=&quot;https://elf.dreamwidth.org/862272.html&quot;&gt;elf&lt;/a&gt; and &lt;a href=&quot;https://ysabetwordsmith.dreamwidth.org/13925560.html&quot;&gt;ysabetwordsmith&lt;/a&gt; in boosting the signal for &lt;a href=&quot;https://www.kickstarter.com/projects/essential-randomness/the-fujoshi-guide-to-web-development&quot;&gt;&lt;cite&gt;The Fujoshi Guide to Web Development&lt;/cite&gt; by Essential Randomness,
    on Kickstarter&lt;/a&gt;.

&lt;blockquote&gt;
&lt;p&gt; The Fujoshi Guide to Web Development is a series of zines/books featuring
    anthropomorphized versions of programming languages and concepts (aka
    gijinka), each one engineered from the ground up to cater to
    transformational fandom&apos;s sensibilities and interests.
&lt;/p&gt;&lt;/blockquote&gt;

&lt;span style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;https://elf.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://elf.dreamwidth.org/&apos;&gt;&lt;b&gt;elf&lt;/b&gt;&lt;/a&gt;&lt;/span&gt; &lt;a href=&quot;https://elf.dreamwidth.org/862272.html&quot;&gt;summarizes
    it&lt;/a&gt; as:

&lt;blockquote&gt;
&lt;p&gt; &lt;strong&gt;Problem:&lt;/strong&gt; The corporate webosphere is all based on public feeds of
    identical-looking scrolling content. Fandom has mostly lost the habit of
    creating their own webspaces for purposes other than constant
    interaction. But most of the tutorials are horribly hostile to beginners,
    or to fandom purposes, or both. 
&lt;p&gt; &lt;strong&gt;Solution:&lt;/strong&gt; Learn web development from hot anime guys in a
    dating sim. Well, not actually a dating sim. But it looks like a dating
    sim.
&lt;/p&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt; ... and appropriately enough the &lt;a href=&quot;https://experimental.essentialrandomness.com/fujoweb/Git_Zine.pdf&quot;&gt;first demo&lt;/a&gt; is about Git (personified as a hawt catboy).  (My guess is
    that Git&apos;s persona was chosen so that they could personify GitHub as an
    octocat-boy.) I&apos;m not in the target demographic, obviously, but I&apos;m all
    for anything that promises to get fans and other outsiders hooked on web
    development and version control.&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1858611&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1858611.html</comments>
  <category>software</category>
  <category>web</category>
  <category>git</category>
  <category>tutorials</category>
  <category>signal-boost</category>
  <lj:mood>amused</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1750335.html</guid>
  <pubDate>Sat, 28 Nov 2020 04:38:49 GMT</pubDate>
  <title>More on branch name changes</title>
  <link>https://mdlbear.dreamwidth.org/1750335.html</link>
  <description>&lt;p&gt; You may remember &lt;a href=&quot;https://mdlbear.dreamwidth.org/1744377.html&quot;&gt;this post about renaming the default branch in Git repositories&lt;/a&gt;.
    Since then I&apos;ve done some script writing -- they say you don&apos;t really
    understand a process until you can write a program that does it, and this
    was no exception.  (There are lots of exceptions, actually, but that&apos;s
    rather beside the point of this post...)

&lt;p&gt; Anyway, here&apos;s what I think is the best way to rename master to main in a
    clone of a repository where that rename has already been done.  (That&apos;s a
    common case anywhere you have multiple developers, each with their own
    clone, or one developer like me who works on a different laptop depending
    on the time of day and where the cats are sitting.)

&lt;pre&gt;     git fetch
     git branch -m master main
     git branch -u origin/main main
     git remote set-head origin main
     git remote prune origin&lt;/pre&gt;

&lt;p&gt; The interesting part is &lt;em&gt;why&lt;/em&gt; this is the best way I&apos;ve found of
    doing it:  1. It works even if master isn&apos;t the current branch, or if it&apos;s
    out of date or diverged from upstream.  2. It doesn&apos;t print extraneous
    warnings or fail with an error.  Neither of those is a problem if you&apos;re
    doing everything manually, but it can be annoying or fatal in a script.
    So here it is again, with commentary:

&lt;p&gt; &lt;code&gt;git fetch&lt;/code&gt; -- you have to do this first, or the &lt;code&gt;git
    branch -u ...&lt;/code&gt; line will fail  because git will think you&apos;re setting
    upstream to a branch that doesn&apos;t exist on the origin.

&lt;p&gt; &lt;code&gt;git branch -m master main&lt;/code&gt; -- note that the renamed branch
    will still be tracking master.  We fix that with...

&lt;p&gt; &lt;code&gt;git branch -u origin/main main&lt;/code&gt; -- many of the pages I&apos;ve seen
    use &lt;code&gt;git&amp;nbsp;push&amp;nbsp;-u...&lt;/code&gt;, but the push isn&apos;t necessary
    and has several different ways it can fail, for example if the current
    branch isn&apos;t main or if it isn&apos;t up to date.
     
&lt;p&gt; &lt;code&gt;git remote set-head origin main&lt;/code&gt; -- This sets main as the
    default branch, so things like &lt;code&gt;git&amp;nbsp;push&lt;/code&gt; will work
    without naming the branch.  You can use &lt;code&gt;-a&lt;/code&gt; for &quot;automatic&quot;
    instead of the branch name, but why make git do extra work?  Many of the
    posts I&apos;ve seen use the following low-level command, which works but isn&apos;t
    very clear and relies on implementation details you shouldn&apos;t have to
    bother with:

&lt;pre&gt;    git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main&lt;/pre&gt;

&lt;p&gt; &lt;code&gt;git remote prune origin&lt;/code&gt; -- I&apos;ve seen people suggesting
    &lt;code&gt;git&amp;nbsp;fetch&amp;nbsp;--prune&lt;/code&gt;, but we already did the fetch way
    back in step 1.  Alternatively, we could use &lt;code&gt;--prune&lt;/code&gt; on that
    first fetch, but then git will complain about master tracking a branch
    that doesn&apos;t exist.  It still works, but it&apos;s annoying in a script.

&lt;blockquote&gt;
&lt;p&gt; Just as an aside because I think it&apos;s amusing:  my former employer (a
    large online retailer) used and probably still uses &quot;mainline&quot; for the
    default branch, and I&apos;ve seen people suggesting as an alternative to
    &quot;main&quot;.  It is, if anything, more jarring than &quot;master&quot; for someone who
    has previously encountered &quot;mainlining&quot; only in the context of
    self-administered street drugs.
&lt;/p&gt;&lt;/blockquote&gt;

&lt;p class=&quot;colophon&quot;&gt; &lt;em&gt;Another fine post from
   &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt; (also at
   &lt;a href=&quot;https://computer-curmudgeon.com/&quot;&gt;computer-curmudgeon.com&lt;/a&gt;).&lt;br&gt;
   Donation buttons in &lt;a href=&quot;https://mdlbear.dreamwidth.org/&quot;&gt;profile&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1750335&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1750335.html</comments>
  <category>git</category>
  <category>computers</category>
  <category>black-lives-matter</category>
  <category>scripting</category>
  <category>curmudgeon</category>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1745953.html</guid>
  <pubDate>Wed, 11 Nov 2020 04:30:58 GMT</pubDate>
  <title>How to Git out of trouble (part 1)</title>
  <link>https://mdlbear.dreamwidth.org/1745953.html</link>
  <description>&lt;p&gt;Hopefully, this post will become the first of a series about solving various
common problems with Git.  Note that the grouping in that phrase is
intentionally ambiguous – it could be either “(solving various common
problems) with Git”, or “solving (various common problems with Git)”, and I
expect to cover both meanings.  Often there are aspects of both:  Git got you
into trouble, and you need to use Git to get yourself out of it.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“It is easy to shoot your foot off with git, but also easy to revert to a
previous foot and merge it with your current leg.” —Jack William Bell&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In many cases, though, this will involve &lt;code&gt;git rebase&lt;/code&gt; rather than &lt;code&gt;merge&lt;/code&gt;, and
I think “rebase it onto your current leg” reads better.&lt;/p&gt;

&lt;h2&gt;Overcoming your fear of &lt;code&gt;git rebase&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Many introductions to Git leave out &lt;code&gt;rebase&lt;/code&gt;, either because the author
considers it an “advanced technique”, or because “it changes history” and the
author thinks that it’s undesirable to do so.  The latter is undermined by the
fact that they usually &lt;em&gt;do&lt;/em&gt; talk about &lt;code&gt;git commit --amend&lt;/code&gt;.  But, like amend,
rebase lets you correct mistakes that you would otherwise simply have to live
with, and avoid some situations that you would have a lot of trouble backing
out of.&lt;/p&gt;

&lt;p&gt;In order to rebase fearlessly, you only need to follow these simple rules:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Always commit your changes before you pull, merge, rebase, or check out
another branch!&lt;/strong&gt; If you have your changes committed, you can always back out
with &lt;code&gt;git reset&lt;/code&gt; if something goes wrong.  Stashing also works, because &lt;code&gt;git
stash&lt;/code&gt; commits your work in progress before resetting back to the last
commit.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Never rebase or amend a commit that’s already been pushed to a shared
branch!&lt;/strong&gt; You can undo changes that were pushed by mistake with &lt;code&gt;git
revert&lt;/code&gt;.  (There are a few cases where you really &lt;em&gt;have to&lt;/em&gt; force-push
changes, for example if you foolishly commit a configuration file that has
passwords in it.  It’s a huge hassle, and everyone else on your team will be
annoyed at you.  If you’re working on a personal project, you’ll be annoyed
at &lt;em&gt;yourself&lt;/em&gt;, which might be even worse.)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;If you’re collaborating, do your work on a feature branch.&lt;/strong&gt; You can use
amend and rebase to clean it up before you merge it.  You can even share it
with a teammate (although it might be simpler to email a patch set).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last rule is a lot less important if you’re working by yourself, but it’s
still a good idea if you want to keep your history clean and understandable –
see &lt;a href=&quot;https://stephen.savitzky.net/Doc/keeping-master-happy/&quot;&gt;Why and
How To Keep Your Master Happy&lt;/a&gt;.  And remember that you’re effectively
collaborating if your project is on &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt;
or &lt;a href=&quot;https://gitlab.com/&quot;&gt;GitLab&lt;/a&gt;, even if nobody’s forked it yet.&lt;/p&gt;

&lt;h2&gt;Push rejected (not fast forward)&lt;/h2&gt;

&lt;p&gt;One common situation where you may want to rebase is when you try to push a
commit and it gets rejected because there’s another commit on the remote repo.
You can detect this situation without actually trying to push – just use &lt;code&gt;git
fetch&lt;/code&gt; followed by &lt;code&gt;git status&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I get into this situation &lt;em&gt;all the time&lt;/em&gt; with my to-do file, because I make my
updates on the master branch and I have one laptop on my desk and a different
one in my bedroom, and sometimes I make and commit some changes without
pulling first to sync up.  This usually happens before I’ve had my first cup
of coffee.&lt;/p&gt;

&lt;p&gt;The quick fix is &lt;code&gt;git pull --rebase&lt;/code&gt;.  Now all of the changes you made are
sitting on top of the commit you just pulled, and it’s safe for you to push.
If you’re developing software, be sure to run all your tests first, and take a
close look at the files that were merged.  Just because Git is happy with your
rebase or merge, that doesn’t mean that something didn’t go subtly wrong.&lt;/p&gt;

&lt;h2&gt;Pull before pushing changes&lt;/h2&gt;

&lt;p&gt;I get into a similar situation at bedtime if I try to pull the day’s updates
and discover that I hadn’t pushed the changes I made the previous night,
resulting in either a merge commit that I didn’t want, or merge &lt;em&gt;conflicts&lt;/em&gt;
that I &lt;em&gt;really&lt;/em&gt; didn’t want.  You can &lt;em&gt;avoid&lt;/em&gt; this problem by always using
&lt;code&gt;git pull --rebase&lt;/code&gt; (and you can set the config variable &lt;code&gt;pull.rebase&lt;/code&gt; to
&lt;code&gt;true&lt;/code&gt; to make that the default, but it’sa little risky).  But you can also
&lt;em&gt;fix&lt;/em&gt; the problem.&lt;/p&gt;

&lt;p&gt;If you have a conflict, you can back get out of it with &lt;code&gt;git merge --abort&lt;/code&gt;.
(Remember that pull is just shorthand for fetch followed by merge.)  If the
merge &lt;em&gt;succeeded&lt;/em&gt; and made an unwanted merge commit, you can use &lt;code&gt;git reset
--hard HEAD^&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Another possibility in this situation is that you have some uncommitted
changes.  In most cases Git will either go ahead with the merge, or warn you
that a locally-modified file will be overwritten by the merge.  In the first
case, you may have merge conflicts to resolve.  In the second, you can &lt;em&gt;stash&lt;/em&gt;
your changes with &lt;code&gt;git stash&lt;/code&gt;, and after the pull has finished, merge them
back in with &lt;code&gt;git stash pop&lt;/code&gt;.  (This combination is almost exactly the same as
committing your changes and then rebasing on top of the pulled commit – stash
actually makes two hidden commits, one to preserve the working tree, and the
other to preserve the index.  You can see it in action with &lt;code&gt;gitk --all&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;… and I’m going to stop here, because this has been sitting in my drafts
folder, almost completely finished, since the middle of January.&lt;/p&gt;

&lt;h3&gt;Resources&lt;/h3&gt;
&lt;ul class=&quot;resource-list&quot;&gt;
  &lt;li&gt; Man page for &lt;a href=&quot;https://git-scm.com/docs/git-merge&quot;&gt;git-merge&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt; Man page for &lt;a href=&quot;https://git-scm.com/docs/git-pull&quot;&gt;git-pull&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt; Man page for &lt;a href=&quot;https://git-scm.com/docs/git-rebase&quot;&gt;git-rebase&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt; Man page for &lt;a href=&quot;https://git-scm.com/docs/git-stash&quot;&gt;git-stash&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;NaBloPoMo stats:
   5524 words in 11 posts this month (average 502/post)
    967 words in 1 post today
&lt;/pre&gt;
&lt;p class=&quot;colophon&quot;&gt; &lt;em&gt;Another fine post from
   &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt; (also at
   &lt;a href=&quot;https://computer-curmudgeon.com/&quot;&gt;computer-curmudgeon.com&lt;/a&gt;).&lt;br /&gt;
   Donation buttons in &lt;a href=&quot;https://mdlbear.dreamwidth.org/&quot;&gt;profile&lt;/a&gt;.&lt;/em&gt;
&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1745953&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1745953.html</comments>
  <category>git-rebase</category>
  <category>troubleshooting</category>
  <category>git</category>
  <category>computers</category>
  <category>curmudgeon</category>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1744377.html</guid>
  <pubDate>Wed, 04 Nov 2020 06:48:18 GMT</pubDate>
  <title>Renaming master to main in Git</title>
  <link>https://mdlbear.dreamwidth.org/1744377.html</link>
  <description>&lt;p&gt; If you&apos;ve been paying attention to the software-development world, you may
    have noticed a movement to &lt;a href=&quot;https://gomakethings.com/removing-racist-terms-in-tech/&quot;&gt;[remove]
    racist terms in tech&lt;/a&gt; contexts.  The most obvious such terms are
    &quot;master&quot; and &quot;slave&quot;, and there are plenty of good alternatives:
    primary/secondary, main/replica, leader/follower, etc.  The one that
    almost every software developer sees every day is Git&apos;s &quot;master&quot; default
    branch.   &lt;a href=&quot;https://gitlab.com/gitlab-org/gitlab/-/issues/221164&quot;&gt;This issue on GitLab&lt;/a&gt; includes some good discussion of what makes
    &quot;main&quot; the best choice for git.  (I&apos;ve also seen &quot;mainline&quot; used.)

&lt;p&gt; &lt;em&gt;Renaming your master branch is easy.&lt;/em&gt; If you have a local repo
    that isn&apos;t a clone of anything (so it doesn&apos;t have any remotes), it&apos;s a
    one-liner:

&lt;pre&gt;   git branch -m master main&lt;/pre&gt;

&lt;p&gt; Renaming the default branch on an existing repo is trivial.  If it has no
    remotes, for example if it&apos;s purely local or a shared repo on a server you
    have an ssh account on, it&apos;s a one-liner:

&lt;pre&gt;   git branch -m master main&lt;/pre&gt;

&lt;p&gt; It&apos;s a little more complicated for a clone, but not &lt;em&gt;much&lt;/em&gt; more
    complicated:
&lt;pre&gt;   git branch -m master main
   git push -u origin main
   git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
   git pull
&lt;/pre&gt;

&lt;p&gt; What you need to do at this point depends on where your origin repo is
    located.  If you&apos;ve already renamed its default branch, you&apos;re done.  If
    you haven&apos;t, the &lt;code&gt;git&amp;nbsp;push&amp;nbsp;-u&lt;/code&gt; created it.  At this
    point if your origin repo is on GitHub, need to log in and change its
    default branch from master to main because it won&apos;t let you delete its
    default branch.

&lt;p&gt; Then, delete the old master branch with

&lt;pre&gt;   git push --delete master&lt;/pre&gt;

&lt;p&gt; This works for simple cases.  It gets a little more complicated on GitHub
    because you might have web hooks, pull requests, and so on that still
    refer to master.  GitHub says that renaming master will be a one-step
    process later in the year, so you may want to wait until then.  For less
    complicated situations, any URLs that reference master will get
    automatically redirected to main.  See &lt;a href=&quot;https://github.com/github/renaming&quot;&gt;this page&lt;/a&gt; for details.

&lt;p&gt; I had a slightly different problem:  my shared repositories are on my web
    host, and there are hook scripts that pull from the shared repo into the
    web directory.  My version of the &lt;code&gt;post-update&lt;/code&gt; only looks for
    changes in the master branch.  Fortunately that&apos;s a one-liner, too:

&lt;pre&gt;   ssh HOST sed -i -e s/master/main/g REPO/hooks/post-update&lt;/pre&gt;
&lt;p&gt; &amp;nbsp;

&lt;p&gt; The next problem is creating a &lt;em&gt;new&lt;/em&gt; repo with main as the default
    branch.   GitHub already does this, so if you are starting your project
    there you&apos;re good to go.  Otherwise, read on:

&lt;p&gt; The Git project has also added a configuration variable,
    &lt;code&gt;init.defaultBranch&lt;/code&gt;, to specify the default branch for new
    repositories, but it&apos;s probably not in many distributions yet.
    Fortunately, there&apos;s a workaround, so if you don&apos;t want to wait for your
    distribution to catch up, you can take advantage of the way
    &lt;code&gt;git&amp;nbsp;init&lt;/code&gt; works, as described in &lt;a href=&quot;https://www.leigh.net.au/writing/git-init-main/&quot;&gt;this article by
    Leigh Brenecki&lt;/a&gt;:

&lt;ol&gt;
  &lt;li&gt; Find out where Git keeps the template that &lt;code&gt;git init&lt;/code&gt; copies
       to initialize a new repo.  On Ubuntu, that&apos;s
       &lt;code&gt;/usr/share/git-core/templates&lt;/code&gt;, but if it isn&apos;t there look
       at the man page for &lt;code&gt;git-init&lt;/code&gt;.
  &lt;li&gt; Copy it to someplace under your control; I used
       &lt;code&gt;.config/git/init-template&lt;/code&gt;.
  &lt;li&gt; &lt;code&gt;cd&lt;/code&gt; to the (new) template and create a file called HEAD,
       containing &lt;code&gt;ref: refs/heads/main&lt;/code&gt;.
  &lt;li&gt; Set the &lt;code&gt;init.templateDir&lt;/code&gt; config variable to point to the
       new template.
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt; Now when git wants to create a new repo, it will use HEAD to tell it which
    branch to create.  Putting all that together, it looks like:

&lt;pre&gt;   cp -a /usr/share/git-core/templates/ ~/.config/git/init-template
   echo ref: refs/heads/main &amp;gt; ~/.config/git/init-template/HEAD
   git config --global init.templateDir ~/.config/git/init-template&lt;/pre&gt;

&lt;p&gt; You can actually replace that initial copy with &lt;code&gt;mkdir&lt;/code&gt;; git is
    able to fill in the missing pieces.  Alternatively, you can add things
    like a default &lt;code&gt;config&lt;/code&gt; file, hooks, and so on.

&lt;p&gt; (I&apos;ve already updated my configuration repository, &lt;a href=&quot;https://gitlab.com/ssavitzky/Honu&quot;&gt;Honu&lt;/a&gt;, to set up the modified
    template along with all the other config files it creates.  But that
    probably doesn&apos;t help anyone but me.)

&lt;h3&gt;Resources&lt;/h3&gt;
&lt;ul class=&quot;resource-list&quot;&gt;
  &lt;li&gt; &lt;a href=&quot;https://gomakethings.com/removing-racist-terms-in-tech/&quot;&gt;Removing racist terms in tech | Go Make Things&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://gomakethings.com/how-to-rename-your-default-github-branch-to-main/&quot;&gt;How to rename your default GitHub branch to main | Go Make Things&lt;/a&gt;
  &lt;li&gt; web tool: &lt;a href=&quot;https://eyqs.ca/tools/rename/&quot;&gt;Rename GitHub
       Default Branches&lt;/a&gt;
  &lt;li&gt;  &lt;a href=&quot;https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/&quot;&gt;5 steps to change GitHub default branch from master to main | Steven M. Mortimer&lt;/a&gt;
  &lt;li&gt;  &lt;a href=&quot;https://github.com/github/renaming&quot;&gt;github: Guidance for changing the default branch name for GitHub repositories&lt;/a&gt;
      -&amp;gt; there will be a seamless 1-step process later this year.
  &lt;li&gt; &lt;a href=&quot;https://github.blog/changelog/2020-07-17-links-to-deleted-branches-now-redirect-to-the-default-branch/&quot;&gt;Links to deleted branches now redirect to the default branch - GitHub Changelog&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://www.hanselman.com/blog/easily-rename-your-git-default-branch-from-master-to-main&quot;&gt;Easily rename your Git default branch from master to main - Scott Hanselman&lt;/a&gt;
  &lt;li&gt;  &lt;a href=&quot;https://dev.to/rhymu8354/git-renaming-the-master-branch-137b&quot;&gt;Git: Renaming the &quot;master&quot; branch - DEV&lt;/a&gt; -&amp;gt; instructions for github and gitlab
  &lt;li&gt;  &lt;a href=&quot;https://gitlab.com/gitlab-org/gitlab/-/issues/221164&quot;&gt;Change the default initial branch name for new projects on GitLab (#221164)&lt;/a&gt;
  &lt;li&gt;  &lt;a href=&quot;https://www.leigh.net.au/writing/git-init-main/&quot;&gt;Changing the default branch for new Git repositories — Leigh Brenecki&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://stackoverflow.com/questions/30987216/change-default-branch-in-gitlab&quot;&gt;Change Default branch in gitlab - Stack Overflow&lt;/a&gt;
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;p class=&quot;colophon&quot;&gt; &lt;em&gt;Another fine post from
   &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt; (also at
   &lt;a href=&quot;https://computer-curmudgeon.com/&quot;&gt;computer-curmudgeon.com&lt;/a&gt;).&lt;br&gt;
   Donation buttons in &lt;a href=&quot;https://mdlbear.dreamwidth.org/&quot;&gt;profile&lt;/a&gt;.&lt;/em&gt;
&lt;pre&gt;NaBloPoMo stats:
   2146 words in 4 posts this month (average 536/post)
    814 words in 1 post today
&lt;/pre&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1744377&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1744377.html</comments>
  <category>curmudgeon</category>
  <category>black-lives-matter</category>
  <category>racism</category>
  <category>computers</category>
  <category>git</category>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1742138.html</guid>
  <pubDate>Fri, 23 Oct 2020 17:22:29 GMT</pubDate>
  <title>Keeping backups</title>
  <link>https://mdlbear.dreamwidth.org/1742138.html</link>
  <description>&lt;p&gt; It&apos;s been a while since I described the way I do backups -- in fact, &lt;a href=&quot;https://stephen.savitzky.net/Doc/Linux/keeping-backups/&quot;&gt;the only
    public document&lt;/a&gt; I could find on the subject was written in 2006, and
    things have changed a great deal since then.  I believe there have been a
    few mentions in Dreamwidth and elsewhere, but in this calamitous year it
    seems prudent to do it again.  Especially since I&apos;m starting to feel
    mortal, and starting to think that some day one of my kids is going to
    have to grovel through the whole mess and try to make sense of it.
    (Whether they&apos;ll find anything worth keeping or even worth the trouble of
    looking is, of course, an open question.)

&lt;p&gt; My home file server, a small Linux box called Nova, is backed up by simply
    copying (almost -- see below) its entire disk to an external hard drive
    every night.  (It&apos;s done using &lt;code&gt;rsync&lt;/code&gt;, which is efficient
    because it skips over everything that hasn&apos;t been changed since the last
    copy.)  When the disk crashes (it&apos;s almost always the internal disk,
    because the external mirror is idle most of the time) I can (and have,
    several times) swap in the external drive, make it bootable, order a new
    drive for the mirror, and I&apos;m done.  Or, more likely, buy a new pair of
    drives that are twice as big for half the price, copy everthing, and
    archive the better of the old drives.  Update it occasionally.

&lt;p&gt; That&apos;s not very interesting, but it&apos;s not the whole story.  I used to make
    incremental backups -- instead of the mirror drive being an exact copy of
    the main one, it&apos;s a sequence of snapshots (like Apple&apos;s Time Machine, for
    example).  There were some problems with that, including the fact because
    of the way the snapshots were made (using &lt;code&gt;cp&amp;nbsp;-l&lt;/code&gt; to copy
    directories but leave hard links to the files that haven&apos;t changed) it
    takes more space than it needs to, and makes the backup disk very
    difficult -- not to mention slow -- to copy if it starts flaking out.
    There are ways of getting around those problems now, but I don&apos;t need
    them.

&lt;p&gt; The classic solution is to keep copies offsite.  But I can do better than
    that because I already have a web host, and I have Git.  I need to back up
    a little.
 
&lt;p&gt; I noticed that almost everything I was backing up fell into one of three
    categories:

&lt;ol&gt; 
  &lt;li&gt; Files I keep under version control.
       
  &lt;li&gt; Files (mostly large ones, like audio recordings) that never change
       after they&apos;ve been created -- recordings of past concerts, my
       collection of ripped CDs, the masters for my CD, and so on.  I
       accumulate &lt;em&gt;more&lt;/em&gt; of them as time goes by, but most of the old
       ones stick around.
       
  &lt;li&gt; Files I can reconstruct, or that are purely ephemeral -- my browser
       cache, build products like PDFs, executable code, downloaded install
       CDs, and of course entire OS, which I can re-install any time I need to
       in under an hour.
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt; Git&apos;s biggest advantage for both version control and backups is that it&apos;s
    distributed -- each working directory has its own repository, and you can
    have shared repositories as well.  In effect, every repository is a
    backup.  In my case the shared repositories are in the cloud on &lt;a href=&quot;https://dreamhost.com/&quot;&gt;Dreamhost&lt;/a&gt;, my web host.  There are
    working trees on Nova (the file server) and on one or more laptops.  A few
    of the more interesting ones have public copies on GitLab and/or GitHub as
    well.  So that takes care of Group 1.

&lt;p&gt; The main reason for using incremental backup or version control is so that
    you can go back to earlier versions of something if it gets messed up.
    But the files in group &lt;em&gt;don&apos;t&lt;/em&gt; change, they just accumulate.
    So I put all of the files in Group 2 -- the big ones -- into
    the same directory tree as the Git working trees; the only difference is
    that they don&apos;t have an associated Git repo.  I keep thinking I should set
    up &lt;a href=&quot;https://git-annex.branchable.com/&quot;&gt;git-annex&lt;/a&gt; to manage
    them, but it doesn&apos;t seem necessary.  The workflow is very similar to the
    Git workflow:  add something (typically on a laptop), then push it to a
    shared server.  The Rsync commands are in a Makefile, so I don&apos;t have to
    remember them: I just &lt;code&gt;make&amp;nbsp;rsync&lt;/code&gt;.  (Rsync doesn&apos;t copy
    anything that is already at the destination and hasn&apos;t changed since the
    previous run, and by  default it ignores files on the destination that
    don&apos;t have corresponding source files.  So I don&apos;t have to have a
    &lt;em&gt;complete&lt;/em&gt; copy of my concert recordings (for example) on my
    laptop, just the one I just made.)

&lt;p&gt; That leaves Group 3 -- the files that don&apos;t have to be backed up because
    they can be reconstructed from version-controlled sources.  All of my
    working trees include a Makefile -- in most cases it&apos;s a link to &lt;a href=&quot;https://gitlab.com/ssavitzky/MakeStuff&quot;&gt;MakeStuff&lt;/a&gt;/Makefile --
    that builds and installs whatever that tree needs.  Programs, web pages,
    songbooks, what have you.  Initial setup of a new machine is done by a
    package called &lt;a href=&quot;https://gitlab.com/ssavitzky/Honu&quot;&gt;Honu&lt;/a&gt;
    (Hawaiian for the green sea turtle), which I described a little over a
    year ago in &lt;a href=&quot;https://mdlbear.dreamwidth.org/1688029.html&quot;&gt;Sable
    and the turtles:  laptop configuration made easy&lt;/a&gt;.

&lt;p&gt; The end result is that &quot;backups&quot; are basically a side-effect of the way I
    normally work, with frequent small commits that are pushed almost
    immediately to a shared repo on Dreamhost.  The workflow for large files,
    especially recording projects, is similar, working on my laptop and
    backing up with Rsync to the file server as I go along.  When things are
    ready, they go up to the web host.  Make targets &lt;code&gt;push&lt;/code&gt; and
    &lt;code&gt;rsync&lt;/code&gt; simplify the process.  Going in the opposite direction,
    the &lt;a href=&quot;https://gitlab.com/ssavitzky/MakeStuff/-/blob/master/scripts/pull-all&quot;&gt;pull-all&lt;/a&gt; command updates everything from the shared repos.

&lt;p&gt; Your mileage may vary.

&lt;h3&gt;Resources and references&lt;/h3&gt;
&lt;ul class=&quot;resource-list&quot;&gt;
  &lt;li&gt; &lt;a href=&quot;https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git.html&quot;&gt;git(1) manual page&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://rsync.samba.org/documentation.html&quot;&gt;rsync documentation&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://gitlab.com/ssavitzky/Honu&quot;&gt;Honu&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://stephen.savitzky.net/Doc/Linux/keeping-backups/&quot;&gt;Keeping
       Backups&lt;/a&gt; (2006)
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;p class=&quot;colophon&quot;&gt; &lt;em&gt;Another fine post from
   &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt; (also at
   &lt;a href=&quot;https://computer-curmudgeon.com/&quot;&gt;computer-curmudgeon.com&lt;/a&gt;).&lt;br&gt;
   Donation buttons in &lt;a href=&quot;https://mdlbear.dreamwidth.org/&quot;&gt;profile&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1742138&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1742138.html</comments>
  <category>backups</category>
  <category>how-i-work</category>
  <category>curmudgeon</category>
  <category>computers</category>
  <category>rsync</category>
  <category>git</category>
  <lj:music>owls somewhere outside</lj:music>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1672725.html</guid>
  <pubDate>Mon, 06 May 2019 23:14:45 GMT</pubDate>
  <title>Holding git repos for ransom - WTF?</title>
  <link>https://mdlbear.dreamwidth.org/1672725.html</link>
  <description>&lt;p&gt; Okay, this one&apos;s a bit weird.  Apparently &lt;a href=&quot;https://www.zdnet.com/article/a-hacker-is-wiping-git-repositories-and-asking-for-a-ransom/&quot;&gt;A hacker is wiping Git repositories and asking for a ransom&lt;/a&gt; (of 0.1
    Bitcoin).  Apparently it was done by scanning the entire web for
    &lt;code&gt;/.git/config&lt;/code&gt; files and mining those for credentials
    (including access tokens and URLs of the form
    &lt;code&gt;http://user.password@victim.com&lt;/code&gt;.  The hacker &quot;replaced&quot; the
    contents of the repository with a ransom demand.

&lt;p&gt; The perpetrator is apparently hoping that anyone stupid enough to leave their
    git repo accessible through the web (I admit -- I used to do that)
    &lt;em&gt;and&lt;/em&gt; to put login credentials in it (no, I&apos;m not &lt;em&gt;that&lt;/em&gt;
    stupid -- that&apos;s one of the things everyone is warned about multiple
    times, just in case it wasn&apos;t obvious), is probably stupid enough to pay
    the ransom instead of simply restoring their repo &lt;em&gt;from any clone of
    it&lt;/em&gt; and changing their password.

&lt;p&gt; And of course it turns out that the entire repo is &lt;em&gt;still there&lt;/em&gt;
    after the attack -- the perpetrator is apparently just adding a commit and
    pointing HEAD at it.  &lt;a href=&quot;https://security.stackexchange.com/questions/209448/gitlab-account-hacked-and-repo-wiped&quot;&gt;this post on StackExchange explains how to recover&lt;/a&gt;.

&lt;p&gt; It&apos;s even easier, though, if you&apos;ve actually been &lt;em&gt;using&lt;/em&gt; the repo,
    because then you&apos;ll have a clone of it somewhere and all you have to do is

&lt;pre&gt;  cd clone
  git push --force origin HEAD:master&lt;/pre&gt;

&lt;p&gt; There&apos;s still the perp&apos;s threat to release your code if you don&apos;t pay.  If
    your code is in a &lt;em&gt;public&lt;/em&gt; repo on GitHub, GitLab, or BitBucket --
    who cares?  If it&apos;s in a &lt;em&gt;private&lt;/em&gt; repo, you may have a problem,
    provided you (1) think it&apos;s likely that this threat can be carried out
    (there is reason to believe that your code hasn&apos;t actually be stashed away
    anywhere) &lt;em&gt;and&lt;/em&gt; (2) you think that whatever secrets may have been
    in your private repo are worth more than about $570.

&lt;p&gt; You can see by looking at &lt;a href=&quot;https://www.blockchain.com/btc/address/1ES14c7qLb5CYhLMUekctxLgc1FV2Ti9DA&quot;&gt;Bitcoin Address 1ES14c7qLb5CYhLMUekctxLgc1FV2Ti9DA&lt;/a&gt; that, so far (4pm
    today) nobody has paid up.

&lt;h3&gt;Resources&lt;/h3&gt;
&lt;ul class=&quot;resource-list&quot;&gt;
  &lt;li&gt; &lt;a href=&quot;https://security.stackexchange.com/questions/209448/gitlab-account-hacked-and-repo-wiped&quot;&gt;ransomware - GitLab account hacked and repo wiped - Information
       Security Stack Exchange&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://fossbytes.com/github-gitlab-bitbucket-repositories-hit-by-ransomware-demanding-bitcoin/&quot;&gt;GitHub, GitLab, BitBucket Repos Hit By Ransomware That Demands
       Bitcoin&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://www.zdnet.com/article/a-hacker-is-wiping-git-repositories-and-asking-for-a-ransom/&quot;&gt;A hacker is wiping Git repositories and asking for a ransom&lt;/a&gt; &lt;a href=&quot;https://en.internetwache.org/dont-publicly-expose-git-or-how-we-downloaded-your-websites-sourcecode-an-analysis-of-alexas-1m-28-07-2015/&quot;&gt;Don&apos;t publicly expose .git&lt;/a&gt; The last section shows how to block web
    access to .git; what you really want to do is block access to &lt;em&gt;all&lt;/em&gt;
    dotfiles except for &lt;code&gt;.well-known&lt;/code&gt;.
  &lt;li&gt; If you&apos;re running Apache and use &lt;code&gt;mod-rewrite&lt;/code&gt;, see 
       &lt;code&gt;https://github.com/h5bp/server-configs-apache/blob/master/src/security/file_access.conf&lt;/code&gt;
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;p class=&quot;colophon&quot;&gt; &lt;em&gt;Another fine post from
    &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt; (also at
    &lt;a href=&quot;https://computer-curmudgeon.com/&quot;&gt;computer-curmudgeon.com&lt;/a&gt;).&lt;br&gt;
    Donation buttons in &lt;a href=&quot;https://mdlbear.dreamwidth.org/&quot;&gt;profile&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1672725&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1672725.html</comments>
  <category>attacks</category>
  <category>ransom</category>
  <category>git</category>
  <category>computers</category>
  <category>curmudgeon</category>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1664910.html</guid>
  <pubDate>Tue, 12 Mar 2019 05:31:04 GMT</pubDate>
  <title>Git for Poets (and other writers): part 1</title>
  <link>https://mdlbear.dreamwidth.org/1664910.html</link>
  <description>&lt;p&gt; In my previous &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;curmudgeon&lt;/a&gt; post, &lt;cite&gt;&lt;a href=&quot;https://mdlbear.dreamwidth.org/1663349.html&quot;&gt;Writing Without
    Distractions&lt;/a&gt;&lt;/cite&gt;, I gave version control only a brief mention, and
    promised a follow-up post.  That would be this one.  This post is intended
    for people who are &lt;em&gt;not&lt;/em&gt; in the software industry, including not
    only poets but other writers, students, people who program as a hobby, and
    programmers who have been in suspended animation for the last decade or
    three and are just now waking up.

&lt;blockquote&gt;
&lt;p&gt; The &lt;a href=&quot;https://en.wikipedia.org/wiki/Version_control&quot;&gt;Wikipedia
    article on version control&lt;/a&gt; gives a pretty good overview, but it
    suffers from being way too general, and at the same time too focused on
    software development.  This post is aimed at poets and other writers, and
    will be using the most popular version control system, &lt;a href=&quot;https://en.wikipedia.org/wiki/Git&quot;&gt;git&lt;/a&gt;.  (That Wikipedia
    article shares many of the same flaws as the one on version control.)  My
    earlier post, &lt;a href=&quot;https://mdlbear.dreamwidth.org/1662041.html&quot;&gt;Git: The other blockchain&lt;/a&gt;, was aimed at software developers and
    blockchain enthusiasts.
&lt;/p&gt;&lt;/blockquote&gt;

&lt;h3&gt;What is version control and why should I use it?&lt;/h3&gt;

&lt;p&gt; A version control system, also called a &lt;a href=&quot;https://en.wikipedia.org/wiki/Software_configuration_management&quot;&gt;software configuration management&lt;/a&gt; (SCM) system, is a system for
    keeping track of changes in a collection of files.  (The two terms have
    slightly different connotations and are used in different contexts, but
    it&apos;s like &quot;writer&quot; and &quot;author&quot; -- a distinction without much of a
    difference.  For what it&apos;s worth, git&apos;s official website is &lt;a href=&quot;https://git-scm.com/&quot;&gt;git-scm.com/&lt;/a&gt;, but the first line of text
    on the site says that &quot;Git is a free and open source distributed version
    control system&quot;.  Then in the next paragraph they use the initialism SCM
    when they want to shorten it.  Maybe it&apos;s easier to type?  Go figure.)

&lt;p&gt; So what does the ability to &quot;track changes&quot; really get you?
&lt;p&gt; &lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___1&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://mdlbear.dreamwidth.org/1664910.html#cutid1&quot;&gt;Quite a lot, actually!&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___1&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;

&lt;h3&gt;...and Finally&lt;/h3&gt;

&lt;p&gt; The part you&apos;ve been waiting for -- the end.  This post is already long,
    so I&apos;ll just refer you to &lt;a href=&quot;#resources&quot;&gt;the resources&lt;/a&gt; for now.
    Expect another installment, though, and please feel free to suggest future
    topics. 

&lt;h3&gt;Resources&lt;/h3&gt;

&lt;h4&gt;Tutorials&lt;/h4&gt;

&lt;ul class=&quot;resource-list&quot;&gt;
  &lt;li&gt; &lt;code&gt;git help tutorial&lt;/code&gt; and &lt;code&gt;git help tutorial-2&lt;/code&gt;.
       You may also have the Git User&apos;s Manual installed on your computer.
  &lt;li&gt; &lt;a href=&quot;https://git-scm.com/docs/everyday&quot;&gt;Everyday Git&lt;/a&gt;.
  &lt;li&gt; &lt;a href=&quot;https://www.learnenough.com/git-tutorial/getting_started&quot;&gt;Learn Enough Git to Be Dangerous&lt;/a&gt;.  This is where I usually point
       newcomers to git.  This is actually the third volume in the &lt;a href=&quot;https://www.learnenough.com/courses&quot;&gt;Learn Enough to Be
       Dangerous&lt;/a&gt; series; the first is about the &lt;a href=&quot;https://www.learnenough.com/command-line-tutorial/basics&quot;&gt;command line&lt;/a&gt; and is a good place to start if you&apos;rle a complete
       beginner with command-line tools.
  &lt;li&gt; GitHub&apos;s &lt;a href=&quot;https://help.github.com/en/articles/git-and-github-learning-resources&quot;&gt;Git and GitHub learning resources&lt;/a&gt; page has links to some good
       tutorials, too.
  &lt;li&gt; &lt;a href=&quot;https://git-scm.com/book/en/v2&quot;&gt;Pro Git - Book&lt;/a&gt; Everything is
       in here, including installation instructions (in Chapter 1) and a
       tutorial (Chapter 2)
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;h4&gt;Digging Deeper&lt;/h4&gt;

&lt;ul class=&quot;resource-list&quot;&gt;
  &lt;li&gt; &lt;a href=&quot;https://git-scm.com/book/en/v2&quot;&gt;Pro Git - Book&lt;/a&gt; The rest
       of &lt;cite&gt;Pro Git&lt;/cite&gt; will take you as deep as you want to go.
  &lt;li&gt; &lt;a href=&quot;https://git-scm.com/docs/user-manual.html&quot;&gt;Git user&apos;s Manual&lt;/a&gt;.
  &lt;li&gt; &lt;a href=&quot;https://git-scm.com/&quot;&gt;Git&lt;/a&gt; Git&apos;s official website
  &lt;li&gt; &lt;a href=&quot;https://git-scm.com/docs&quot;&gt;Git - Reference&lt;/a&gt; This is the
       official reference manual, in the form of Unix &quot;man&quot; pages.  That means
       that you can use the &lt;code&gt;man&lt;/code&gt; command to read them, but it&apos;s
       easier to follow links on the web.
  &lt;li&gt; &lt;code&gt;git help&lt;/code&gt; - that&apos;s right, the manual is also available by
       way of git itself.  That can be very convenient.
  &lt;li&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Git&quot;&gt;Git - Wikipedia&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Version_control&quot;&gt;Version control - Wikipedia&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Software_configuration_management&quot;&gt;Software configuration management - Wikipedia&lt;/a&gt;
  &lt;li&gt; &lt;a href=&quot;https://mdlbear.dreamwidth.org/1662041.html&quot;&gt;Git: The other blockchain&lt;/a&gt;
&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;p class=&quot;colophon&quot;&gt; &lt;em&gt;Another fine post from
    &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt; (also at
    &lt;a href=&quot;https://computer-curmudgeon.com/&quot;&gt;computer-curmudgeon.com&lt;/a&gt;).&lt;br&gt;
    Donation buttons in &lt;a href=&quot;https://mdlbear.dreamwidth.org/&quot;&gt;profile&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1664910&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1664910.html</comments>
  <category>computers</category>
  <category>git</category>
  <category>haiku</category>
  <category>curmudgeon</category>
  <category>scm</category>
  <lj:music>falling rain on mynoise.net</lj:music>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>4</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1662041.html</guid>
  <pubDate>Fri, 22 Feb 2019 06:25:57 GMT</pubDate>
  <title>Git: The other blockchain</title>
  <link>https://mdlbear.dreamwidth.org/1662041.html</link>
  <description>&lt;h3&gt;Part 1: Blockchain&lt;/h3&gt;
&lt;p&gt; Blockchain is the technology behind Bitcoin and other cybercurrencies.
    That&apos;s about all anyone outside the software industry knows about it; that
    and the fact that lots of people are claiming that it&apos;s going to transform
    everything.  (The financial industry, the Web, manufacturing supply chains,
    identity, the music industry, ... the list goes on.)  If you happen to be
    &lt;em&gt;in&lt;/em&gt; the software industry and have a moderately good idea of what
    blockchain is, how it works, and what it can &lt;em&gt;and can&apos;t&lt;/em&gt; do, you
    may want to skip to &lt;a href=&quot;#part-2&quot;&gt;Part 2&lt;/a&gt;.

&lt;p&gt; Still with me?  Here&apos;s the fifty-cent summary of blockchain.  Blockchain
    is a distributed, immutable ledger.  Buzzword is a buzzword buzzword
    buzzword?  Blockchain is a chain of blocks?  That&apos;s closer.

&lt;p&gt; The purpose of a blockchain is to keep track of financial transactions
    (that&apos;s the &quot;ledger&quot; part) and other data by making them public (that&apos;s
    half of the &quot;distributed&quot; part), keeping them in blocks of data (that&apos;s
    the &quot;block&quot; part) that can&apos;t be changed (that&apos;s the &quot;immutable&quot; part, and
    it&apos;s a really good property for a ledger to have), are linked together by
    hashes (that&apos;s the &quot;chain&quot; part, and we&apos;ll get to what hashes are in a
    moment), with the integrity of that chain guaranteed by a large group of
    people (that&apos;s the other half of the &quot;distributed&quot; part) called &quot;miners&quot;
    (WTF?).

&lt;p&gt; Let&apos;s start in the middle:  how can we link blocks of data together so
    that they can&apos;t be changed?  Let&apos;s start by making it so that any change
    to a block, or to the order of those blocks, can be detected.  Then, the
    fact that everything is public makes the data impossible to change without
    that change being glaringly obvious.  We do that with hashes.

&lt;p&gt; A hash function is something that takes a large block of data and turns it
    into a very long sequence of bits (which we will sometimes refer to as a
    &quot;number&quot;, because any whole number can be represented by a sequence of
    binary digits, and sometimes as a &quot;hash&quot;, because the data has been
    chopped up and mashed together like the corned beef hash you had for
    breakfast).  A good hash function has two important properties:

&lt;ol&gt;
  &lt;li&gt; It&apos;s irreversible.  Starting with a hash, it is effectively impossible to
       construct a block of data that will produce that hash.  (It is
       significantly easier to construct two blocks with the same hash, which
       is why the security-conscious world moves to larger hashes from time to
       time.) 
  &lt;li&gt; It&apos;s unpredictable.  If two blocks of data differ anywhere, even by a
       single bit, their hashes will be &lt;em&gt;completely&lt;/em&gt; different.
&lt;/li&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt; Those two together mean that if two blocks have the same hash, they
    contain the same data.  If somebody sends you a block and a
    hash, you can compare the hash of the block and if it matches, you can be
    certain that the block hasn&apos;t been damaged or tampered with before it got
    to you.  And if they also cryptographically &lt;em&gt;sign&lt;/em&gt; that hash, you
    can be certain that they used the key that created that signature.

&lt;p&gt; Now let&apos;s guarantee the integrity of the &lt;em&gt;sequence&lt;/em&gt; of blocks by
    chaining them together.  Every block in the chain contains the hash of the
    previous block.  If block B follows block A in the chain, B&apos;s hash depends
    in part on the hash of block A.  If a villain tries to insert a forged
    transaction into block A, its hash won&apos;t match the one in block B.

&lt;p&gt; Now we get to the part that makes blockchain interesting:  getting
    everyone to agree on which transactions go into the next block.  This is
    done by &lt;em&gt;publishing&lt;/em&gt; transactions where all of the miners can see
    them.  The miners then get to work with &lt;del&gt;shovels and pickaxes&lt;/del&gt;
    &lt;ins&gt;big fast computers&lt;/ins&gt;, validating the transaction, putting it into
    a block, and then running a contest to see which of them gets to add their
    block to the chain and collect the associated reward.  Winning the contest
    requires doing a &lt;em&gt;lot&lt;/em&gt; of computation.  It&apos;s been estimated that
    miners&apos; computers collectively consume roughly the same amount of
    electricity as Ireland.

&lt;p&gt; There&apos;s more to it, but that&apos;s blockchain in a nutshell.  I am
    &lt;em&gt;not&lt;/em&gt; going to say anything about what blockchain might be good for
    besides keeping track of virtual money -- that&apos;s a whole other rabbit hole
    that I&apos;ll save for another time.  For now, the important thing is that
    blockchain is a system for keeping track of financial transactions by
    using a chain of blocks connected by hashes.

&lt;p&gt; The need for miners to do work is what makes the virtual money they&apos;re mining
    valuable, and makes it possible for everyone to agree on who owns how much
    of it without anyone having to trust anyone else.  It&apos;s all that work that
    makes it possible to detect cheating.  It also makes it expensive and
    slow.  The Ethereum blockchain can handle about ten transactions per
    second.  Visa handles about 10,000.


&lt;h3&gt;Part 2: The &lt;em&gt;other&lt;/em&gt; blockchain&lt;/h3&gt;

&lt;p&gt; Meanwhile, in another part of cyberspace, software developers are using
    another system based on hash chains to keep track of their software -- a
    distributed version control system called &lt;code&gt;git&lt;/code&gt;.  It&apos;s almost
    completely different, except for the way it uses hashes.  How different?
    Well, for starters it&apos;s both free and fast, and you can use it at home.
    And it has nothing to do with money -- it&apos;s a version control system.

&lt;blockquote&gt;
&lt;p&gt; If you&apos;ve been with me for a while, you&apos;ve probably figured out that I&apos;m
    extremely fond of git.  This post is &lt;em&gt;not&lt;/em&gt; an introduction to git
    for non-programmers -- I&apos;m working on that.  However, if you managed to
    get this far it does contain enough information to stand on its own,
&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt; Git doesn&apos;t use transactions and blocks; instead it uses &quot;objects&quot;, but
    just like blocks each object is identified by its hash.  Instead of
    keeping track of virtual money, it keeps track of files and their
    histories.  And just as blockchain keeps a complete history of everyone&apos;s
    coins, git records the complete history of everyone&apos;s data.

&lt;p&gt; Git uses several types of object, but the most fundamental one is called a
    &quot;blob&quot;, and consists of a file, its size, and the word &quot;blob&quot;.  For
    example, here&apos;s how git idenifies one of my Songs for Saturday posts:

&lt;pre&gt;git hash-object 2019/01/05--s4s-welcome-to-acousticville.html
957259dd1e41936104f72f9a8c451df50b045c57&lt;/pre&gt;

&lt;blockquote&gt;
&lt;p&gt; Everything you do with git starts with the &lt;code&gt;git&lt;/code&gt; command.  In
    this case we&apos;re using &lt;code&gt;git&amp;nbsp;hash-object&lt;/code&gt; and giving it the
    pathname of the file we want to hash.  Hardly anyone needs to use the
    &lt;code&gt;hash-object&lt;/code&gt; subcommand; it&apos;s used mainly for testing and the
    occasional demonstration.
&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt; Git handles a &lt;em&gt;directory&lt;/em&gt; (you may know directories as &quot;folders&quot; if
    you aren&apos;t a programmer) by combining the names, metadata, and hashes of
    all of its contents into a type of object called a &quot;tree&quot;, and taking the
    hash of the whole thing.

&lt;p&gt; Here, by the way, is another place where git really differs from blockchain.
    In a blockchain, all the effort of mining goes into making sure that every
    block points to its one guaranteed-unique correct predecessor.  In other
    words, the blocks form a chain.  Files and directories form a tree, with
    the ordinary files as the leaves, and directories as branches.  The
    directory at the top is called the root.  &lt;em&gt;Top?&lt;/em&gt; Top.  For some
    reason software trees grow from the root down.  After a while you get used
    to it.

&lt;p&gt; Actually, that&apos;s not quite accurate, because git stores each object in
    exactly one place, and it&apos;s perfectly possible for the same file to be in
    two different directories.  This can be &lt;em&gt;very&lt;/em&gt; useful -- if you
    make a hundred copies of a file, git only has to store one of them.  It&apos;s
    also inaccurate because trees, called &lt;a href=&quot;https://en.wikipedia.org/wiki/Merkle_tree&quot;&gt;Merkle Trees&lt;/a&gt; are
    used &lt;em&gt;inside&lt;/em&gt; of blocks in a blockchain.  But I digress.

&lt;blockquote&gt;
&lt;p&gt; Technically the hash links in both blockchains and git form a &lt;a href=&quot;https://en.wikipedia.org/wiki/Directed_acyclic_graph&quot;&gt;directed
    acyclic graph&lt;/a&gt; -- that means that the links all point in one direction,
    and there aren&apos;t any loops.  In order to make a loop you&apos;d have to predict
    the hash of some later block, and you just can&apos;t do that.  I have &lt;a href=&quot;https://computer-curmudgeon.com/Blog/2018/09/19/single-link/&quot;&gt;another post about why this is a good thing.&lt;/a&gt;
&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt; And that brings us to the things that make git, git:  commits.  (&quot;Commit&quot;
    is used in the same sense, more or less, as it is in the phrase &quot;commit
    something to memory&quot;, or &quot;commit to a plan of action&quot;.  It has very little
    to do with crime.  Hashes are even more unique than fingerprints, and we
    all know what criminals think about fingerprints.  In cryptography, the
    hash of a key is &lt;em&gt;called&lt;/em&gt; its fingerprint.)

&lt;p&gt; Anyway, when you&apos;re done making changes in a project, you type the command

&lt;pre&gt;git commit&lt;/pre&gt;

&lt;p&gt; ... and git will make a new commit object which contains, among other
    things, the time and date, your name and email address, maybe your
    cryptographic signature, a brief description of what you did (git puts you
    into your favorite text editor so you can enter this if you didn&apos;t put it
    on the command line), the hash of the current root, and &lt;em&gt;the hash of
    the previous commit&lt;/em&gt;.  Just like a blockchain.

&lt;p&gt; Unlike earlier version control systems, git never has to compare files;
    all it has to do is compare their hashes.  This is &lt;em&gt;fast&lt;/em&gt; -- git&apos;s
    hashes are only 20 bytes long, no matter how big the files are or how many
    are in a directory tree.  And if the hashes of two &lt;em&gt;trees&lt;/em&gt; are the
    same, git doesn&apos;t have to look at any of the blobs in those trees to know
    that they are all the same.

&lt;p&gt; 


&lt;blockquote style=&quot;white-space: pre-wrap;&quot;&gt;
  @ &lt;a href=&quot;https://hackernoon.com/blockchain-101-only-if-you-know-nothing-b883902c59f7&quot;&gt;Blockchain 101 — only if you ‘know nothing’! – Hacker Noon&lt;/a&gt; 
  @ &lt;a href=&quot;https://medium.com/@sbmeunier/when-do-you-need-blockchain-decision-models-a5c40e7c9ba1&quot;&gt;When do you need blockchain? Decision models. – Sebastien Meunier&lt;/a&gt;

  @ &lt;a href=&quot;https://git-scm.com/book/en/v2/Git-Internals-Git-Objects&quot;&gt;Git - Git Objects&lt;/a&gt;
  @ &lt;a href=&quot;http://gitready.com/beginner/2009/02/17/how-git-stores-your-data.html&quot;&gt;git ready » how git stores your data&lt;/a&gt;
  @ &lt;a href=&quot;https://en.wikibooks.org/wiki/Git/Internal_structure&quot;&gt;Git/Internal structure - Wikibooks, open books for an open world&lt;/a&gt;
  @ &lt;a href=&quot;https://computer-curmudgeon.com/Blog/2018/09/19/single-link/&quot;&gt;Why Singly-Linked Lists Win* | Stephen Savitzky&lt;/a&gt;
&lt;/blockquote&gt;

&lt;p class=&quot;colophon&quot;&gt; &lt;em&gt;Another fine post from
    &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt; (also at
    &lt;a href=&quot;https://computer-curmudgeon.com/&quot;&gt;computer-curmudgeon.com&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1662041&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1662041.html</comments>
  <category>git</category>
  <category>curmudgeon</category>
  <category>software</category>
  <category>hashing</category>
  <category>blockchain</category>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1622746.html</guid>
  <pubDate>Tue, 05 Jun 2018 17:44:16 GMT</pubDate>
  <title>Git and GitHub, with a side of Microsoft</title>
  <link>https://mdlbear.dreamwidth.org/1622746.html</link>
  <description>&lt;p&gt; If you develop software and haven&apos;t just returned from the moon, you&apos;ve
    undoubtedly heard that &lt;a href=&quot;https://blog.github.com/2018-06-04-github-microsoft/&quot;&gt;GitHub&lt;/a&gt; is
    being acquired by &lt;a href=&quot;https://blogs.microsoft.com/blog/2018/06/04/microsoft-github-empowering-developers/&quot;&gt;Microsoft&lt;/a&gt;.  Depending on your affiliations you might be spelling
    &quot;being acquired by&quot; as &quot;selling out to&quot;.  The rest of you are probably
    wondering what on Earth a GitHub is, and why Microsoft would want one.
    Let me explain.

&lt;p&gt; Please note:  this post isn&apos;t about my opinion of today&apos;s news.  It&apos;s
    really too early to tell, though I may get into that a little toward the
    end.  Instead, I&apos;m going to explain what GitHub is, and why it matters.
    But first I have to explain &lt;a href=&quot;https://git-scm.com/&quot;&gt;Git&lt;/a&gt;.

&lt;p&gt; Git is a version-control system.  (Version-control systems are sometimes
    called &quot;source code management&quot; (SCM) systems.  If you look closely you
    might even have spotted &quot;scm&quot; in git&apos;s URL up there at the end of the last
    paragraph.)  Basically, a version-control system lets you record the
    complete history of a project, with what changes were made, who made the
    each change, when they changed it, and their notes about what they did and
    why.  It doesn&apos;t have to be a software project, either.  It can be
    recipes, photographs, books, the papers you&apos;re writing for school, or even
    blog entries.  (Yes, I do.)

&lt;p&gt; Before git, most version-control systems kept track of changes in text
    files (which of course is what all source code is) by recording which
    lines are different from the previous version.  (It&apos;s usually done by a
    program called &lt;code&gt;diff&lt;/code&gt;.)  This was very compact, but it could
    also be very slow if you had to undo all the changes between two versions
    in order to see what the older one looked like.

&lt;p&gt; Git, on the other hand, is blindingly fast in part because it works in the
    stupidest way possible (which is &lt;em&gt;why&lt;/em&gt; it&apos;s called &quot;git&quot;).  It
    simply takes the new version of each file that changed since the last
    version, zips it up, and stuffs it whole into its repository.  So it takes
    git about the same amount of time to roll a file back two versions or two
    hundred.

&lt;p&gt; The other thing that makes git fast is where it &lt;em&gt;keeps&lt;/em&gt; all of its
    version information.  Before git, most version-control systems used a
    centralized repository on a server somewhere.  (Subversion, one of the
    best of these, even lets you browse the repository with a web browser.)
    That means that all the change information is going over a network.  Git
    keeps its repository (these days everyone shortens that to &quot;repo&quot;) on your
    local disk, right next to your working copy, in a hidden subdirectory
    called &quot;&lt;code&gt;.git&lt;/code&gt;&quot;.

&lt;p&gt; Because its repo is local, and contains the entire history of your
    project, you don&apos;t need a network connection to use git.  On the beach, in
    an airplane, on a boat, &lt;del&gt;with a goat&lt;/del&gt;, it doesn&apos;t matter to git.
    It&apos;s &lt;em&gt;de&lt;/em&gt;-centralized.  It gets a little more complicated when more
    than one developer is working on a project.

&lt;p&gt; Bob&apos;s been in the office all week working on a project.  When his boss,
    Alice, comes back from the open source conference she&apos;s been at all week,
    all she has to do is tell git to fetch all the changes that Bob made while
    she was away.  Git gets them directly from Bob&apos;s repo.  If Alice didn&apos;t
    make any changes, that&apos;s called a &quot;fast-forward&quot; merge -- git just takes
    the changes that Bob made, copies those files into Alice&apos;s repo, updates
    her working tree, and it&apos;s done.

&lt;p&gt; It&apos;s a little trickier if Alice had time to make some changes, too.  Now
    Alice has to merge the two sets of changes, and then let Bob pull the
    merged files onto &lt;em&gt;his&lt;/em&gt; computer.  By the way, a &quot;pull&quot; is just a
    fetch followed by a merge, but it&apos;s so common that git has a shorthand way
    of doing it. (I&apos;m oversimplifying here, but this isn&apos;t the time to go into
    the difference between merge and rebase.  It&apos;s also not a good time to
    talk about branches -- maybe some other week.)  As you can imagine, this
    gets out of hand pretty quickly, and it&apos;s even worse if there&apos;s a whole
    team working on the project.

&lt;p&gt; The obvious thing to do is for the group to have one repo on a server
    somewhere that has what everyone agrees is the definitive set of files on
    it.  Bob pushes his changes to the server, and when Alice tries to push
    &lt;em&gt;her&lt;/em&gt; changes, git balks and gives her an error message.  Now it&apos;s
    Alice&apos;s responsibility to make any necessary fixes and push them to the
    server.  Actually, in a real team, Alice would send her proposed changes
    around by making a diff and sending email to the other team members to
    review, and not actually push her changes until someone approves them.

&lt;p&gt; In a large team, this is kind of a hub-and-spokes arrangement.  You can
    see where this is going, right? 

&lt;p&gt; &lt;a href=&quot;https://github.com&quot;&gt;GitHub&lt;/a&gt; is a company that provides a place
    for people and projects to put shared git repositories where other people
    can see them, clone them, and contribute to them.  GitHub has become
    wildly popular, because it&apos;s a great place to share software.  If you have
    an open-source software project, putting a public repo on GitHub is the
    most effective way to reach developers.  It&apos;s so popular that Google and
    Microsoft shut down their own code-hosting sites (Google Code and CodePlex
    respectively) and moved to GitHub.  Microsoft, it turns out, is GitHub&apos;s
    biggest contributor.

&lt;p&gt; Putting a public repository on GitHub is free.  If you want to set up
    &lt;em&gt;private&lt;/em&gt; repositories, GitHub will charge you for it, and if your
    company wants to put a clone of GitHub on its own private servers they can
    buy GitHub Enterprise, but if your software is free, so&apos;s your space on
    GitHub.

&lt;p&gt; That&apos;s a bit of a problem, because the software that runs GitHub is
    &lt;em&gt;not&lt;/em&gt; free.  That means that they need a steady stream of income to
    pay their in-house developers, because they&apos;re not going to get any help
    from the open-source developer community.  GitHub lost $66 million in
    2016, and doesn&apos;t really have a sustainable business model that would make
    them attractive to investors.  They needed to get acquired, or they had a
    real risk of going under.  And when a service based on proprietary
    software goes under, all of their customers have a big problem.  But their
    users?  Heh.

&lt;p&gt; Everybody knows the old adage, &quot;if you&apos;re getting a service for free
    you&apos;re not the customer, you&apos;re the product.&quot;  That&apos;s especially true for
    companies like Google and Facebook, which sell their users&apos; eyeballs to
    advertisers.  It&apos;s a lot less true for a company whose users can leave any
    time they want, painlessly, taking all their data &lt;em&gt;and their
    readers&lt;/em&gt; with them.  I&apos;m sure most of my readers here on Dreamwidth
    remember what happened to Livejournal when they got bought by the
    Russians.  Well, GitHub is being bought by Microsoft.  It&apos;s not entirely
    clear which is worse.

&lt;p&gt; GitHub has an even worse problem than Livejournal did, because
    &quot;cross-posting&quot; is basically the way git &lt;em&gt;works.&lt;/em&gt; There&apos;s a company
    called &lt;a href=&quot;https://gitlab.com&quot;&gt;GitLab&lt;/a&gt; that looks a lot like
    GitHub, except that their core software -- the stuff that wraps a slick
    web interface around a git repository -- is open source.  (They do sell
    extensions, but most projects aren&apos;t going to need them.)  If you want to
    set up your own private GitLab site, it&apos;s free, and you can do it in ten
    minutes with a one-line command.  If you find bugs, you can fix them
    yourself.  You&apos;ll find a couple of great quotes from their blog at the end
    of the notes, but the bottom line is that 100,000 repositories have moved
    from GitHub to GitLab &lt;em&gt;in the last 24 hours.&lt;/em&gt;

&lt;p&gt; And once you&apos;ve moved a project to GitLab, you don&apos;t have to worry about
    what happens to it, because the open-source core of it will continue to be
    maintained by its community.  That&apos;s what happened when a company called
    Netscape went belly-up:  Mozilla Firefox is still around and doing fine.
    And if the fact that GitLab is for profit is a problem for you, there&apos;s
    Apache Allura, gitolite3, gitbucket, and gitweb (to name a few).  Go for
    it! 

&lt;p&gt; &amp;nbsp;
&lt;p&gt; This &lt;em&gt;so&lt;/em&gt; wasn&apos;t what I was planning to write today.

&lt;pre&gt;&lt;strong&gt;Notes:&lt;/strong&gt;
  @ &lt;a href=&quot;https://www.linuxjournal.com/content/microsoft-reportedly-acquire-github&quot;&gt;Microsoft Reportedly Acquires GitHub | Linux Journal&lt;/a&gt;
    The article ends with a list of alternatives:
    &lt;a href=&quot;https://gitea.io/en-us/&quot;&gt;Gitea&lt;/a&gt;
    &lt;a href=&quot;https://allura.apache.org/&quot;&gt;Apache Allura&lt;/a&gt;
    &lt;a href=&quot;https://gitbucket.github.io/&quot;&gt;GitBucket: A Git platform&lt;/a&gt;
    &lt;a href=&quot;https://about.gitlab.com/&quot;&gt;GitLab&lt;/a&gt;
  @ &lt;a href=&quot;http://www.tfir.io/microsoft-acquires-github-for-7-5-billion/&quot;&gt;Microsoft acquires GitHub for $7.5 billion - TFiR&lt;/a&gt;
    &quot; According to reports, GitHub lost over $66 millions in 2016. At the same time
      GitLab, a fully open source and decentralized service is gaining momentum, giving
      users a fully open source alternative. &quot;
  @ &lt;a href=&quot;https://news.microsoft.com/2018/06/04/microsoft-to-acquire-github-for-7-5-billion/&quot;&gt;Microsoft to acquire GitHub for $7.5 billion | Stories&lt;/a&gt; official press release
  @ &lt;a href=&quot;https://blogs.microsoft.com/blog/2018/06/04/microsoft-github-empowering-developers/&quot;&gt;Microsoft + GitHub = Empowering Developers - The Official Microsoft Blog&lt;/a&gt;
  @ &lt;a href=&quot;https://blog.github.com/2018-06-04-github-microsoft/&quot;&gt;A bright future for GitHub | The GitHub Blog&lt;/a&gt;
  @ &lt;a href=&quot;https://about.gitlab.com/2018/06/03/microsoft-acquires-github/&quot;&gt;Congratulations GitHub on the acquisition by Microsoft | GitLab&lt;/a&gt;
    &quot; While we admire what&apos;s been done, our strategy differs in two key areas. First,
      instead of integrating multiple tools together, we believe a single application,
      built from the ground up to support the entire DevOps lifecycle is a better
      experience leading to a faster cycle time. Second, it’s important to us that the
      core of our product always remain open source itself as well. &quot;
  @ &lt;a href=&quot;https://about.gitlab.com/2018/06/05/gitlab-ultimate-and-gold-free-for-education-and-open-source/&quot;&gt;GitLab Ultimate and Gold now free for education and open source | GitLab&lt;/a&gt; 
    &quot; It has been a crazy 24 hours for GitLab. More than 2,000 people tweeted about
      #movingtogitlab. We imported over 100,000 repositories, and we&apos;ve seen a 7x increase
      in orders. We went live on Bloomberg TV. And on top of that, Apple announced an
      Xcode integration with GitLab. &quot;
&lt;/pre&gt;

&lt;p&gt; &lt;em&gt;Another fine post from &lt;a href=&quot;https://mdlbear.dreamwidth.org/tag/curmudgeon&quot;&gt;The Computer Curmudgeon&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1622746&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1622746.html</comments>
  <category>computers</category>
  <category>git</category>
  <category>microsoft</category>
  <category>curmudgeon</category>
  <category>github</category>
  <category>software</category>
  <category>open-source</category>
  <lj:mood>didactic</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>9</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://mdlbear.dreamwidth.org/1535580.html</guid>
  <pubDate>Wed, 03 Dec 2014 02:13:27 GMT</pubDate>
  <title>Done last month (20141123 Su - 30 Su)</title>
  <link>https://mdlbear.dreamwidth.org/1535580.html</link>
  <description>&lt;p&gt; On the health front, I may &lt;em&gt;finally&lt;/em&gt; be learning to relax the
    muscles in my lower back that make it hurt when I walk.  Maybe.  It also
    seems to have a lot to do with how heavy my shoulder bag is, so that&apos;s
    going to be an ongoing problem.  A backpack would be better, except that
    it&apos;s hard to get off when I take a seat in the bus, and unlike a shoulder
    bag I can&apos;t swing it around when I want to get at something like my
    wallet. 
&lt;/p&gt;
&lt;p&gt; I&apos;ve finally started doing some serious system administration/scripting
    work to get my website working directories the rest of the way under git
    control.  That&apos;s done -- I can now say &quot;make deploy&quot; in a web directory
    and have it committed, pushed to the remote repo, and pulled into the
    website with no further attention.
&lt;/p&gt;
&lt;p&gt; In the process, I had to write a script for converting a directory from
    CVS to git.  There are a couple of challenges in that process because the
    old CVS repositories were in pretty bad shape, with stuff not having been
    checked in consistently.  Not like a well-maintained software project, in
    other words.  Bad bear.  No cookie.  My websites don&apos;t use cookies anyway.
&lt;/p&gt;
&lt;p&gt; The associated asset archive is going to be harder, because some
    directories have large media files in them.  Like, um... the audio.  The
    goal is to eliminate the use of rsync snapshots for backups (for reasons I
    will probably go into in more detail in a later post).
&lt;/p&gt;
&lt;p&gt; Detail in the notes, as usual.
&lt;/p&gt;
&lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___1&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://mdlbear.dreamwidth.org/1535580.html#cutid1&quot;&gt;raw notes, with links&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___1&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=mdlbear&amp;ditemid=1535580&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://mdlbear.dreamwidth.org/1535580.html</comments>
  <category>git</category>
  <category>shopping</category>
  <category>holidays</category>
  <category>software</category>
  <category>health</category>
  <category>done</category>
  <category>web</category>
  <category>links</category>
  <lj:mood>okay</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>6</lj:reply-count>
</item>
</channel>
</rss>
