Unit 10 · lesson

GitHub, Push, README, and Remote History

Core path: 30 minutes

What changes when your local Git repository is connected to another repository somewhere else?

You gain another copy of the history—and another system boundary to understand.

A remote can support backup, collaboration, review, automation, and publication. It can also make mistakes more public if you push content you never meant to share.

Local history exists before the remote

You can have:

LOCAL REPOSITORY
commit A
commit B
commit C

without GitHub at all.

A configured remote adds another repository:

LOCAL                         REMOTE
A                             A
B                             B
C  -- not pushed yet -->      ?

After a successful push, the remote can receive commit C.

The commit existed locally before the push.

That is the mental model to keep.

git remote -v tells you where Git thinks the remote is

Before pushing in a managed class environment:

git remote -v

Read the configured URLs.

Do not assume the remote is correct because somebody told you "GitHub is connected."

Repository state is inspectable.

If your class does not provide a managed remote, skip remote operations. Local Git history is enough to learn version control.

No public account is required just to complete the core Git work.

git push transfers commits; it does not verify them

A simplified model:

local commits
     ↓ git push
configured remote repository

If the local commit contains a bug, push can transmit the bug.

If the local commit contains a secret, push can transmit the secret.

If the local commit has a vague message, the remote now has the vague message too.

Pushing distributes history. It does not certify the history.

git pull is not "download my files"

A pull normally involves fetching remote Git information and then integrating appropriate remote changes into the current local branch according to Git's configuration and state.

For now, keep the beginner distinction:

push → send local commits toward remote
pull → bring remote branch changes into local work

The exact merge/rebase behavior can vary with configuration. Do not memorize one oversimplified animation and assume Git always behaves identically.

When in doubt:

git status
git branch --show-current
git remote -v

Know which branch and repository you are operating on before synchronizing.

README is the first handoff document

A useful README.md should help another developer answer:

What is this project?
What does it do?
What environment does it expect?
How do I run it?
How do I test it?
Where is important data/configuration?
What limitations should I know about?

A README is not a marketing paragraph that says:

This awesome Python project demonstrates innovative coding concepts.

That tells the next developer almost nothing.

Write operational information.

.gitignore controls normal untracked-file behavior

A Python project often ignores:

__pycache__/
*.pyc
.venv/
.env

This says Git should normally leave matching untracked paths outside version control.

Important limitation:

.gitignore does not magically untrack a file that is already committed.

If a secret was committed first and you add .env to .gitignore afterward, the secret may already exist in Git history or on a remote.

Prevention is better than trying to erase published history later.

Secrets do not belong in the repository

Do not commit:

passwords
API keys
access tokens
private keys
student records
confidential school information

A .gitignore is a guardrail, not a secret-management system.

If credentials are exposed, assume they may need to be revoked/rotated according to the relevant service policy. Deleting the visible line from the latest file is not proof that history no longer contains it.

Branches are movable lines of history

A branch is not a duplicated folder.

It is a Git reference that identifies a line/tip of development.

Conceptually:

A --- B --- C   main
       \
        D --- E  feature-search

Both branches share earlier history.

The feature branch can develop changes without immediately moving main to those new commits.

Later, approved changes can be integrated according to the team's workflow.

This becomes extremely useful with AI-assisted changes: you want generated work isolated, inspectable, and recoverable before it becomes the main trusted state.

Remote branches are another layer

You may see names such as:

main
origin/main

These are not necessarily the same reference at every moment.

Your local main can have commits the remote-tracking state does not yet know about, or the remote can advance elsewhere.

That is why phrases such as:

It's on main.

can be incomplete.

Which repository? Which branch reference? Which commit?

Git can answer those questions if you inspect the state.

Trace one local commit to a remote

Suppose your local history is:

c3 Add player search
b2 Save roster to JSON

and the configured remote currently has only b2.

Before pushing:

local main  → c3
remote main → b2

After a successful push of the intended branch:

local main  → c3
remote main → c3

The code did not become correct because both references now point to c3.

You merely synchronized that commit.

Your tests and review remain separate evidence.

Prove .gitignore rather than trusting the file

Create a harmless temporary file:

temporary.log

Add to .gitignore:

temporary.log

Run:

git status

The file should not appear as a normal untracked path.

Now you have observed the rule's effect.

Do the same with .venv/ later rather than assuming your environment folder is being ignored.

Remote is optional; documentation is not

Even without GitHub access, you can still produce strong developer evidence:

git status
git diff
git diff --staged
git log --oneline

plus a useful README and ignore rules.

That is intentional. The course is teaching software-development behavior, not forcing students to create public accounts.

Before Lesson 4

You should be able to distinguish:

save file locally
git add
git commit
git push
git pull

and say which state/boundary each operation affects.

If those all feel like different ways of saying "save my project," go back through the layers before building the project history.

Optional video: Git, GitHub, and GitHub Desktop for beginners. If your school network blocks the embedded player, open the video directly on YouTube.

Vocabulary lab

Flip the idea, not just the card

Explain the term before you reveal the back. Then compare your explanation with the definition, example, and warning.

1 / 6
Read all terms without animation
Remote Repository
A Git repository stored outside the current local repository and referenced by a remote name such as origin. Example: A teacher-managed GitHub repository. Do not confuse it with: The local repository and working tree on the current workspace.
Push
Transfer local commits/references to a configured remote according to the Git command and permissions used. Example: git push sends eligible local branch commits to the remote. Do not confuse it with: git commit, which creates a local checkpoint.
Pull
Bring remote branch changes into the current local work through Git's fetch/integration behavior. Example: git pull on an assigned classroom branch. Do not confuse it with: Downloading an arbitrary file from a website.
README
Project documentation that explains purpose, setup, execution, testing, and other important context for humans. Example: README.md describing how to run the roster project. Do not confuse it with: Source code that implements the application.
.gitignore
A file containing path patterns Git should normally leave untracked. Example: Ignoring .venv/ and __pycache__/. Do not confuse it with: A security vault or a tool that removes already-committed secrets from history.
Branch
A Git reference representing a movable line/tip of development history. Example: feature-search containing commits not yet integrated into main. Do not confuse it with: A duplicate project folder.