git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Cervin Edin <erik@cervined.in>
To: Aman <amanmatreja@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: About GIT Internals
Date: Wed, 25 May 2022 23:14:17 +0200	[thread overview]
Message-ID: <CA+JQ7M_OmfJVJpnYc1h=L226nZqo0A=5USCEJAgrK2EKPRsW4w@mail.gmail.com> (raw)
In-Reply-To: <CACMKQb0Mz4zBoSX2CdXkeF51z_mh3had7359J=LmXGzJM1WYLg@mail.gmail.com>

On Wed, May 25, 2022 at 10:14 PM Aman <amanmatreja@gmail.com> wrote:
>
> And if I am being completely honest, I didn't understand most of it.

You are not alone, there are many that struggle with understanding how
git works internally.

> (I am a high school student, and really want to learn more about how
> all the great software and hardware around us work - which so many of
> us take for granted)

Perhaps not a good resource, depending on your familiarity with
computer science but
https://eagain.net/articles/git-for-computer-scientists/
is an article that is often recommended.

I think for me, the hardest part of understanding Git was the
difficulty conceptualizing it.
But at its core Git is very simple.

You can think of it as a folder of files that you can "save" (commit)
whenever you want.
Each time you "save" (commit), all files and folders are "copied" to
another folder (the local repository).
That means that if you ever want to look at a previous version of a
file, it's there.
For simplicity's sake you can think of this as being unchangeable.
Once a file is saved it's saved forever.

Just having a messy pile of every single version of a file is not useful,
so the rest of git consists of making this manageable.
For example by remembering who saved it, when and why (by making them
write a message when they save).

The main thing however is that Git orders saves.
This order is not necessarily one version after another, sorted by
when they were saved.
Instead, order is manually controlled by saving files in different
places (branches).
In its simplest form, a branch is several saves, one after another.

Because of how Git orders saves, I can work on files, save them and
give them to you.
You can keep working on those files and make your own saves.
But I don't have to wait for you to send your work back to me.
I can keep working on the same files and making my own saves.

When you're done you can put your saves in a "shared folder" (a remote
repository).
Later, when I'm done, I can get your saves and Git can help me figure
out which parts of the files that you changed that I didn't and copy
both of our work into new files (merging).

This is a bit of an oversimplification and Git allows users to do more
advanced things but the gist is basically this.

  parent reply	other threads:[~2022-05-25 21:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 16:10 About GIT Internals Aman
2022-05-25 16:49 ` Emily Shaffer
2022-05-25 21:14 ` Erik Cervin Edin [this message]
2022-05-25 23:34 ` git-vger
2022-05-26  8:47   ` Philip Oakley
     [not found]     ` <CACMKQb3exv13sYN5uEP_AG-JYu1rmVj4HDxjdw8_Y-+maJPwGg@mail.gmail.com>
2022-05-27 14:40       ` Philip Oakley
     [not found]         ` <C4B1A93D-800F-4C49-93D5-86FE58B1DDCA@hxcore.ol>
2022-05-27 15:14           ` Philip Oakley
2022-05-30  9:49         ` Kerry, Richard
2022-05-30 11:53           ` Konstantin Khomoutov
2022-05-30 13:50             ` Ævar Arnfjörð Bjarmason
2022-06-03 12:18               ` Aman
2022-06-03 15:23                 ` Konstantin Khomoutov
2022-06-04 15:24                   ` Aman
2022-06-06 11:52                     ` Konstantin Khomoutov
2022-06-03 15:25                 ` Emily Shaffer
2022-06-03 17:15                   ` Junio C Hamano
2022-05-26 12:45 ` Konstantin Khomoutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+JQ7M_OmfJVJpnYc1h=L226nZqo0A=5USCEJAgrK2EKPRsW4w@mail.gmail.com' \
    --to=erik@cervined.in \
    --cc=amanmatreja@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).