Files
Lee Hanken 7c8efd2228 Initial commit: HPR Knowledge Base MCP Server
- MCP server with stdio transport for local use
- Search episodes, transcripts, hosts, and series
- 4,511 episodes with metadata and transcripts
- Data loader with in-memory JSON storage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 10:54:13 +00:00

280 lines
23 KiB
Plaintext

Episode: 2512
Title: HPR2512: Intro to git remote
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2512/hpr2512.mp3
Transcribed: 2025-10-19 04:26:56
---
This in HPR episode 2,512 entitled Intro to Get Remote, it is hosted by Klaatu and in
about 27 minutes long and Karina Cleanflag, the summer is all about Get Remote.
This episode of HPR is brought to you by AnanasThost.com.
Get 15% discount on all shared hosting with the offer code HPR15, that's HPR15.
Better web hosting, that's Honest and Fair, at AnanasThost.com.
Hi everyone, this is HPR15, my name is Klaatu and this episode is going to be a continuation
of my Get Basics series, I guess is what I'll call it.
In the previous episode we did a paper exercise to illustrate some of the principles of Get.
Namely the way that a project that two people are working on can diverge and create what
we would call a fork in a road if we were traveling along a real-life path.
And what we generally do call forks in Get and we also call more often than not just branches
because for whatever reason in computers we use trees or plants as an analogy a lot.
So there's this idea of there being a master branch and then from that branch there are
these other branches that diverge much like on a tree branch and you have different files
within each branch.
And then at the end of the episode last time we created a very basic kind of rudimentary
Get repository just locally on our own machine.
In this episode I want to set up a little bit of an exercise environment so that we can
play around and experience all kinds of fun problems that you might expect to find in
the real world.
And in order to do that we can recycle the one that we created initially but I'm just
going to create a new set with simpler names to be honest.
So I'm going to make a repository called Dev, well let's call one Alice, make their
Alice, make their Bob and then we're going to make their remote server.
So we've got three directories, we've got Alice Bob and remote server.
Cool.
So Alice and Bob live far apart and then remote server is somewhere else.
We can imagine it's a cloud hosting service like GetLab or not a bug.org or get hub.com
or whatever you happen to use.
Now we need to make all of these get repositories but they need to be get repositories of a
different sort.
Two of them can be the same but one of them needs to be a special kind of get repository.
And the one that needs to be a special kind is the remote server, that's the one that
no one really touches directly, it's off in the cloud somewhere, we don't interact with
it directly, we just push and pull to and from it.
So let's just go into the alphabetically here, let's go into Alice's directory and we'll
do, we did this last time, it was a get in it, get space INIT.
And it tells you, hey, you've got to get repository now.
And you might recall if you do an LS-A, you see that there's a hidden folder called .get.
And if you're really mischievous, you could do a get list and LS.get and look inside of
that hidden directory.
Of course, you'd never go inside that directory, you'd never mess around with any of the files
inside of that directory, but you could look.
Okay, so Alice is pretty much set up for now, she's as set up as we can get her set up
until we do some other things.
So we're going to CD back out into our main directory, we'll go over to Bob and we'll
do the same thing, get in it, done, LS-A, yep, there's the get folder, great.
So we have two empty get repositories, we're going to CD back out one more time and go into
the remote server directory, sorry, you know what, I'm going to change that name because
that could get to confusing, I thought it would be helpful.
I'm going to move remote server to fake remote, there we go, that's better.
Now I'm changing into fake remote and then I'm going to do a, now don't do this before
I do because this is, this will be different, you'll think it's the same, it's different.
I'm doing a get in it, space dash dash bear, B-A-R-E and if you do that, it tells you initialized
empty get repository in this current directory.
Okay, so and now if you do an LS, you might be surprised at what you see.
Now if you're really astute, you'll notice that the contents of this directory are
awfully similar to the contents of the .get directory in Allises and Bob's local repositories
and in fact, it's exactly the same, they are, it's the same frame, this skeletal framework
as the hidden directory in a get repository.
So this is a directory, this would be the back end to your geto light server or to your
get lab account or whatever, that's, this is the stuff that nobody interacts with directly,
it's the stuff that is tracking the information that you push out to the world, okay?
So what we've just set up are two local repositories for two imaginary developers and one bear
repository on some remote server of some kind.
It could be someone's pie in their bedroom, it could be someone's cloud in a data center,
doesn't matter, point is it's a remote server.
Okay, so now that all of that exists, we'll go back over into Allises directory and we
will create a file and we did this last time but we're going to do it again really quick
and we'll just put in the classic hello world.
So we'll echo quote, hello space world, close quote, redirect to zero one dot TXT and now
there's a file there, it's called zero one dot TXT and now if we do a get status of course
we should see that there is, there is one untracked file, it is called zero one dot TXT and
it tells us that we can add that file if we want to commit it.
So we can do a get add oh one dot TXT and get status again and it tells us yep there's
going to be a commit if you unless you uncash, if you unstage it, it won't be committed
but otherwise this is going to be committed.
So let's go ahead and commit it then.
So that's a get commit space dash M for message and then in quotes I'll put added a text
file and it tells me that a file has changed and there was one insertion and that's good.
So essentially for the local work, if all I'm doing is working locally I'm done, that's
all I had to do.
Now of course we're not working locally anymore, we want to start sharing our code with our
friend Bob.
So in order to share it with Bob we want to push it to some common location and that
is of course the fake remote.
So what we're going to do is we're going to kind of expand gets world here and the way
that we do that right now get only is aware of itself is get as far as get knows it's
a local repository.
There's no outside world and you can prove that to yourself by doing a get remote that's
get space remote space dash V for verbose and you'll get nothing back.
There's nothing there.
That's fine because we can tell it about remotes.
We can add a remote to our get repository.
Now when we say that we're going to add a remote all we're doing is we're entering some
stuff in the terminal here and into essentially a config file just through a command.
So we're going to do a get remote and the very sort of default canonical way of doing
this is get space remote space add space origin space and in the address of the origin
server.
Now I don't know why exactly they they chose origin for the default name but that's
what everyone defaults to.
I mean the get developers just decided that the remote server that you consider your sort
of centralized repository in this un in this famously decentralized version control system
is going to be called origin.
Now that might confuse you if you're from SVN I think maybe the equivalent would be trunk
possibly I could be wrong about that because I've never really I've used SVN like once
or well now about 15 times but but I'm not really super into the culture so I don't know
or the history but but that's what it's called it's origin so when you hear origin chances
are what you're really thinking is the remote server the one that is not in my room right
now the one that's out there somewhere unless of course your remote server is a Raspberry
Pi in your bedroom in which case it's just right over there in the corner but assuming
you know sort of pretending that everything remote is out there in the world then that's
what the origin would be now you don't have to call it origin but I guarantee you if you
do that if you call it something other than origin people will be confused and by people
I mean you so get remote ad origin and then for our purposes in this in this exercise we're
just going to do it we're going to we're faking get out we're relying to it so we're
not actually telling it about a server anywhere we're telling it about a directory so I'm
just going to do origin dot dot slash H no fake fake remote and there it goes it's created
now an origin point called dot dot slash fake remote so if I do a get remote dash v for
verbose then it tells me that the origin is dot dot slash fake remote for fetch and dot
dot slash fake remote for push and that is what we once okay so now what we really we can
do so if we do a get log we see that we we've got that one commit that we made just five
minutes ago and three minutes ago whatever it is and then we can do a get remote nope we can
do a get push dash U and the dash U stands for set up stream so you could even do a get push
dash dash set dash up stream origin so we're pushing into our remote server our fake remote
and then what what are we pushing we're pushing the current state of our repository the current
committed state of our repository and the term for that the shorthand the the the the designator
for that is head all in capitals so capital H capital E capital A capital D for Delta and and
why do we call it head it's like a playhead on one of them old time cassette players you might
have might have seen them somewhere and get will use phrases from that like fast forwarding
and rewinding and things like that so that's that the head designator means whatever has been
committed on your local computer right now will get pushed to the origin hit return and it tells
you to dot dot slash fake remote new branch head master branch master set up to track remote
branch master from origin which is telling you from now on your master branch on your local
computer is tied a kind of mirrored linked to the master branch on the origin on that remote
server called origin so now we're going to go back over or not back over we're going to go over
to Bob's computer and I think we've got nothing here yeah empty and if we do a get remote dash V
for remote we'll find that there's no remote set up so so Bob needs to grab this information
from the server now he can do that a couple of different ways but the easiest most direct way
then I and I think the normal way would be to clone the repository you may have cloned a
repository before or you might have heard the term certainly if you've ever been to one of those
public get hosts you've probably seen buttons or encouragements that you can clone a repository
no actually I think they use fork anyway get cloning is how you grab a repository from someone else's
server and bring it down to your local computer so we'll do a get clone and then normally you
would do something like maybe get at get lab dot com colon slash blah blah or not colon slash
but just colon not clad to whatever but we're not doing that this is all local so we're just going
to do dot dot slash fake remote and then we'll tell it that we want to clone that the data that
it finds there at fake remote we want to clone it to the current directory so I'm going to just
put a dot so get clone dot dot slash fake remote dot and there you go I've made my first mistake
and probably if you've been following along so have you it tells me that it's a fatal error the
destination path dot already exists and is not an empty directory well so what's that what that
is telling me is that Bob should not have made his folder a get repository yet so what I'm going to
do is I'm going to trash dot get and now I'm doing an LS-A and now I've got an empty empty repository
in in Bob's directory or an empty folder rather in Bob's directory now I'm going to do the get
clone dot dot slash fake remote dot and it says it's cloning into dot and it's done and now if I do an
LS in fact an LS-A I see that there's a new dot get directory that's the one from Alice's
repository plus the text file cat or zero one dot txt which I'm going to now cat and it says
hello world so Bob is now mirroring essentially the the repository from our remote our fake remote
and in fact we can get more information if we do a get remote dash v for verbose and it tells
us that the origin is slash home slash clatu slash hpr get slash bob slash dot dot slash fake
remote for fetch and the same thing for push that's a little bit ugly that's a bit verbose I mean
we could set the we could reset the the origin to just being dot dot slash fake remote in fact
it's not that hard to do you can do it with a get remote command so get I mean we don't have to
but I'm just going to tell tell you how to do it just so you'll get familiar with these
kinds of operations so get space remote space set dash url url origin so we want to we're
basically resetting the url for the origin to I'm just going to put dot fake remote or I mean dot
dot slash fake remote so I do that and now if you do a get remote dash v you'll see that the fetch
address oh both of the addresses okay I thought I would had to do it again for push but apparently
not so get remote set url origin dot dot slash fake remote resets the origin address to just dot
dot slash I mean the other one is perfectly valid but it's kind of ugly and kind of clunky I mean
going all the way into this directory only to go back one and then into the fake remote seems a
little bit silly so I'm just I'm pointing it straight to the my fake remote so setting setting
urls and and and and even adding new remotes is completely possible it's something that I do quite
frequently to be to be honest and I've I've done it a lot for a lot of different purposes so it's
something to get it's something to not be afraid of I guess you don't necessarily need to get
familiar with it because maybe that's not your workflow but it's something to kind of get familiar
with in terms of at least demystifying how get knows magically where to send all of your data or
how to get the updates speaking of getting updates we should we should we should we should mess around
with that a little bit we should we should do some some interesting branch operations but I think
for this episode I think the job has been done and the job has been to set up repositories locally
for for future episodes and it has been to familiarize you with the get space remote command
I guess I guess we could at least do a proof of concept because this is running a bit short I feel
it's only been a couple of almost 20 minutes not even 20 minutes yet I don't think so yeah let's do
a quick proof of concept just to prove that yes Bob is now on board so first what we'll do just
this is a kind of a little bit of a taste of next episode but first what we're going to do is do
a get branch command which is simply get space branch and it tells us that we have one branch
and it's called master and I think I mentioned this in the previous episode master is just the
default name for for your primary branch it's the one that gets created for you by default and
we've already done a cat of zero one dot txt so it's got the string hello world so let's say that
Bob is a little bit pedantic and he believes that that hello world should be capitalized hello
capital H world and then it should have a full stop at the end so we'll add that and then just
to populate this file a little bit more we'll add a second line we'll keep that blank and then on
the third line we'll we'll put something like welcome to get full stop there so now we've got three
lines in this file so he is just he has just changed a file in the master branch now what he
might do because Bob and Alice are apparently kind of new to get because if they weren't new to get
they would be using branches already but they're new to new to get and they're fearless and so
they say okay that's fine let's let's Bob can just push that straight to master so we'll do a get add
and then we'll do a get get add either dot for adding everything in his current directory which
is zero dot txt zero one dot txt or you can do a get add zero one dot txt whatever you feel more
most comfortable with and then get commit dash m for message quote quote and in the quotes we'll add
corrected syntax corrected let's just do Bob's first commit there okay there we go Bob's first
commit and now we'll do a get push now here's the thing about actually no that's this is because
this is master so we're going to do a get push origin head now online you will see a lot of people
just doing a get push and technically speaking that's perfectly valid I am just urging you not to do
that I I favor a verbosity sometimes an explicitness and this is one of the cases where I really really
do encourage it because if you've got a bunch of branches with a bunch of stuff in them and you just
type in get push surprise surprise you have you've pushed all kinds of things to your remote that
you maybe you didn't really mean to so I like to be very explicit get push origin so we're
pushing stuff to the origin which is fake remote and what are we pushing to origin we're pushing
the state of our of our committed repository right now which is of course represented by the
designated head return oops I hit the up here and said return and there it goes it says writing
objects three of three blah blah blah okay so now we'll change directory back over to Alice's
directory we do an LS we still have just the one file that's good we do a cat of zero one dot
txt and it's just hello world all lowercase no punctuation so how does she get those changes from the
remote repository well there are a couple of different ways there's a shorthand way which as you
can probably guess I'm not going to use and there's the actual way like there's the thing that's
actually happening behind the scenes of that shorthand command so the shorthand command just so
you'll know is get pull and you will use get pull and I'm I use get pull all the time but to
begin with I think get pull is a little bit of a again it's got a little bit of magic to it
because it does two separate actions kind of all at once so what it does actually is it does a get
fetch and then it does a get merge of something okay so what we're going to do then is we're going
to do a get fetch and when I say get fetch when I type that in and hit return it gives me some
feedback and it says counting objects three done total three delta zero unpacking objects 100%
three of three done from dot dot slash fake remote that's my remote server so that's good and
then it gives me some hashes it tells me that the D52 to E1 E4 and and then it tells me master
and then a little arrow to origin slash master okay so that's just something to keep in mind
you'll you'll see those phrase those terms again very soon so now if I do a get log I see that I
still only have one one log entry and that was added a text file which I did earlier in this
episode so nothing from Bob yet as far as we can tell so how do I get the information that I know
that you and I both know is should be there we as Bob just pushed some information to fake remote
so how do we get the information that we know we've just surely received how do we get it into
our workspace well I like to think of this in terms a little bit of if you've ever used GIMP
then you'll know that when you when you select something and you copy something like you let's say
you've got a picture you select it to select a space a portion of a new copy or you cut maybe
and then you paste it back in when you paste it it comes in as this floating layer and that
floating layer you can see you can interact with you can move it around but until you anchor it
to something it's just a floating layer it's kind of a metal layer or a temporary plane of
existence so that's kind of how I think of what we got from fetch fetch is this stuff and it
it's there on our repository but it hasn't been merged into any branch yet and in fact you can
even kind of you can technically see this information I mean not exactly but but you can get
some insight into this by doing a get space branch space dash dash all and that shows you where
where if you want to call when we just do it get branch it's just master yeah but if we do a get
branch all dash dash all then we see that there's master but then there's like the secret hidden
repository the branch called remotes slash origin slash master so that's that's more or less
where that stuff is is residing the stuff that we fetched is kind of hiding away in that origin
slash master branch so the way to get that stuff into our master branch is we do a get merge
and then the word master and then origin slash master I told you you were going to see that term
again the syntax for the actual merge is a little bit a little bit flexible to be honest you the
the way that I was taught to do it was get space merge space master which is the name of your current
branch and then space origin slash master which is the the source of the thing that you are merging
so you can do it that way honestly you can also just do get merge origin slash master because it
defaults to merging that to your current branch and since we are currently on the master branch
it'll just get merged into where we are right now I'm a creature of habit and I like explicit
commands so I'm going to do get merge master origin slash master now understand of course I think
you do understand but understand that our master branch here is our local master branch and we
are therefore merging the master branch in a different name space as it were to this one so origin
slash master is distinct from just master all right I'm going to hit return on this and it shows
media that it is merging updating d52 to e14 fast forward 0 1 dot txt four additions one file
changed three insertions and one deletion and if I do a cat 0 1 dot txt now Alice's file is is
matching bobs it's hello world full stop blank line welcome to get full stop there you go that was
two different repositories pushing and fetching and merging such that they are now in sync again
in the next episode we will do a bunch more stuff with branches lots of get branch work that we
will even do a get conflict which usually sends shivers down down users spines so that'll be
cool tune in it'll be amazing you've been listening to hecka public radio at hecka public
radio dot org we are a community podcast network that releases shows every weekday Monday through
Friday today's show like all our shows was contributed by an hbr listener like yourself if
you ever thought of recording a podcast then click on our contributing to find out how easy it
really is hecka public radio was founded by the digital dog pound and the infonomican computer club
and it's part of the binary revolution at binwreff.com if you have comments on today's show
please email the host directly leave a comment on the website or record a follow-up episode yourself
unless otherwise stated today's show is released under creative comments attribution share
3.0 license