How Git and GitHub work together
Git runs on each computer. GitHub holds the shared repository. Follow one change from your working files, through review, into a teammate's copy.
One team, separate local histories
Git runs on each computer. GitHub holds the shared repository.
A and B are commits. Δ is an uncommitted edit. Red shows the current transfer. Choose any step or play the whole flow.
| Compare | Git | GitHub |
|---|---|---|
| What it is | The version-control tool that records your project history. | A service that hosts Git repositories and team collaboration. |
| Where | On each computer, using its local repository. | A hosted service accessed through Git tools and your browser. |
| What you do | Stage changes, commit, branch and merge. | Share branches, open PRs, review changes and run checks. |
| Offline | Local edits, commits and branches work without an internet connection. | Exchanging commits with GitHub and using its online reviews needs a connection. |
You can use Git without GitHub. GitHub is one option for hosting and collaborating on Git repositories. git status inspects your current changes. git log shows recorded commits.
Key concepts
Git records your project's history. GitHub hosts a shared repository and the team's reviews. Start with the files on your computer, then follow what each action changes.
Repository and clone
"Give me my own copy to work on."
A repository is a project plus its Git history. Cloning copies a repository from GitHub to your computer.
Your computer
Editable files + history
originGitHub
skills/Shared files + history
Start with the shared repository on GitHub. Clone it to get your own local copy.
Stage and commit
"Choose the changes, then record a checkpoint."
Editing changes a file. Staging selects what the next commit will contain. The commit records that selection in local history.
All three states are on your computer.
Working file
List the sources.
research/ SKILL.mdStaging area
No change selected
git addLocal history
git commitBranch
"Let me develop this change on its own line."
A branch is a name pointing to a commit. Create one, then watch its name advance when you commit on it. main is a common name for the team's integrated branch.
Push and pull
"Share my commits. Bring back the team's commits."
The two repositories can have different histories. Push sends commits to a remote branch. Pull fetches remote commits and integrates them into your current local branch.
Your computer
fix-researchGitHub
fix-researchPull request and merge
"Review this change before it joins main."
A pull request, or PR, proposes a merge. Reviewers inspect the changes and checks. Merging integrates the reviewed work into the target branch.
Require links in research
Open for reviewfix-research → main · commit B
Branches and worktrees work together
A branch names a line of work. A worktree is the folder where its files are open. Watch one folder switch branches, then keep two tasks open in separate folders.
Illustrative example. Controls change no real files or repositories. Use Play, the step buttons or the left and right arrow keys.
Your normal checkout already has a working tree. Extra worktrees share its local repository history and branch names. Another computer usually has a separate clone. Git normally prevents one branch being checked out in two worktrees at once.
Building in a shared repo
Follow Maya and Leo from separate local changes to a shared release. Try different files, overlapping edits and a workflow whose output and input disagree.
Illustrative example. Controls change no real files or repositories. Use Play, the step buttons or the left and right arrow keys.
Uploaded, merged and available are different states
Follow version 2 through the release process. Watch the live version stay at 1 until publication finishes. Then compare a separate release with automatic publication.
Illustrative example. Controls change no real files or repositories. Use Play, the step buttons or the left and right arrow keys.
The repository configuration determines the real trigger. A push or merge may start checks and deployment. A successful build may still wait for approval. A PR preview can be separate from production. Some teams update installed skills through a synchronised checkout.
Check your understanding
Try these without reopening the definitions. Each answer gives immediate feedback.
Maya wants an urgent fix and her unfinished task open in separate folders. What does she add?
The changes touch different files and Git reports no conflict. Does that prove the workflow works?
The branch was pushed. Are its new skills available to users?
Primary docs & guides
Explain the journey from a local edit to an installed team skill from memory. Then ask your agent to walk through the same steps in your repo.
- Pro Git: Branches in a Nutshellgit-scm.com
- Pro Git: Recording Changesgit-scm.com
- Pro Git: Working with Remotesgit-scm.com
- Git: git-worktree documentationgit-scm.com
- GitHub Docs: Pull requestsdocs.github.com
- GitHub Docs: Configuring a publishing sourcedocs.github.com
- Building skills and workflows/guides/skills-and-workflows/