Git keeps the words and the filename separately.
The new words hello, Git are saved as one record. Git calls a saved file’s contents a blob. A blob contains the contents, but it does not contain the name hello.txt.
A beginner’s guide
git push?Git does not zip up the folder on your laptop. Open one tiny push and the pieces become visible: saved file contents, a folder listing, a commit, and a request to move a branch label.
01 · Start with one edit
Imagine a tiny project with three entries: hello.txt, README.md, and a src/ folder. You change only one line: hello becomes hello, Git.
The folder on your computer is still where you edit. git add hello.txt puts the version you chose into a selected list for the next save. Git calls that selected list the index.
hello.txt: hello → hello, GitREADME.md: unchanged · src/: unchanged
The new words hello, Git are saved as one record. Git calls a saved file’s contents a blob. A blob contains the contents, but it does not contain the name hello.txt.
So something else must say where those words belong. Git saves a folder listing: a map with rows for hello.txt, README.md, and src/.
The hello.txt row points to the new saved contents. The unchanged rows can keep pointing to the records the old version already used.
Git calls this saved folder listing a tree. A tree maps names to saved file contents, or to another tree when the name is a subfolder.
What to watch Read the left card as a folder map: names on the left, saved contents or subfolders on the right. The simplified table is illustrative; the relationship is how Git represents folders.
The root folder listing now describes this project version: new hello.txt, unchanged README.md, and unchanged src/.
A commit points to that root folder listing. It does not carry a physical folder inside it; it points to the map that describes the folder.
The commit also points to the earlier commit. That one link is how this project version becomes part of a history of versions.
main is a readable label, called a ref, that now points to the new commit. The label moves. Both saved versions remain.
What to watch The commit points to the folder map and the version before it. The blue main bookmark points to the commit; it does not carry project files.
The remote already has the earlier version plus the unchanged README and src/ records. In this example, Git does not need to send those again.
Git gathers records for transfer in a compact bundle called a packfile. Think of it as a parcel with a contents list, not a literal cardboard box.
Here the parcel contains three new pieces: the changed file contents, the new root folder listing that names those contents, and the new commit that saves the listing.
After receiving those records, the remote can accept the request to move main to the new commit. The host’s rules decide whether it accepts that request.
What to watch The parcel names every piece it carries. Three is correct only for this stated example: one root-level file changed and the remote already had everything else.
05 · Why this is not “only diffs”
The commit above points to a complete root folder listing. That listing reaches every file in the project, including unchanged ones. Git can reuse the saved records that did not change, so a new version is not a fresh copy of every file.
When you ask for git diff, Git compares two saved versions and shows the difference. The difference is useful output; it is not the only way Git understands the project.
A host can keep Git’s saved contents, folder listings, commits, and branch labels in a bare repository: repository data without a checked-out project folder.
The host also adds access rules and team tools: pull requests, issues, and reviews. Those features help people work with Git history; they are not replacements for it.
A pull request points people at commits to discuss. The discussion and review notes are not themselves a blob, folder listing, or commit.
Git LFS is optional. For a selected large file, Git stores a pointer while LFS stores and retrieves the file’s payload.
What to watch Git history, team tools, and optional LFS have separate jobs. The shelves are not a physical diagram of GitHub’s infrastructure.
06 · A compact glossary
hello, Git, but not the name hello.txt.hello.txt to those contents and maps the other folder names too.main that points to a commit.| Thing | Its job | What it is not |
|---|---|---|
| Git push | Transfers records the remote needs, then proposes branch updates. | A zip upload of your current working folder. |
| Git history | Keeps file contents, folder listings, and commits connected. | A pull-request conversation or permission rule. |
| Pull request | Gives a team a place to discuss commits and decide what to merge. | A commit or a separate copy of all project files. |
07 · The answer
In this example, the remote already has the old version. So Git sends three new records: the new words in hello.txt, the new folder listing that names those words, and the commit that saves that listing. Then it asks to move main to that commit.
GitHub can host this same history and add pull requests, reviews, and access rules around it. Once you can picture the contents, folder listing, commit, and branch label as separate pieces, a git push stops looking like a mysterious folder upload.