Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Version Control with Git and GitHub  ›  Capstone Project

GitHub: Sharing Sprout

GitHub 15 minGitHub hosts a remote copy of a Git repository that you push commits to and others clone from, and pull requests let teammates review changes from a branch before merging.

GitHub: Sharing Sprout

So far Sprout's history lives only on your laptop. If the disk dies, it is gone, and no one else can help. GitHub is a hosting service for Git repositories: it keeps a copy online, shows the code and history in a browser, and gives a place to review each other's changes.

The rule

Push to share, clone to join, pull request to propose.

Publishing an existing project

After creating an empty repository on GitHub:

git remote add origin https://github.com/you/sprout.git
git branch -M main      # name your branch main, if it is not already
git push -u origin main
  • A remote is a named link to another copy of the repository. origin is the usual name for the main one.
  • push sends your commits up. -u remembers the link, so later a plain git push is enough.
  • pull brings down commits others have pushed.

Joining a project

git clone https://github.com/you/sprout.git
cd sprout
flutter pub get
flutter run

.dart_tool/ is not in the repository, so each new machine must fetch the packages. flutter pub get does that; flutter run and most editors also trigger it automatically, but running it straight after cloning surfaces any version problem before you start working.

Proposing a change

Instead of pushing straight to main, make a branch, commit there, push it, and open a pull request on GitHub. Teammates read the changes, comment, and merge when it is ready. Main stays working while the idea is being reviewed.

git switch -c dark-theme
git commit -am "Add dark theme"
git push -u origin dark-theme

The shortcut

Picture the flow as clone, branch, commit, push, PR, merge, and ask "which step am I on?"

A friend adds dark modeStep 1 of 4
  1. Clone

    git clone the repository, then flutter pub get so it builds.

The trap is thinking git commit shares your work. A commit is local until you push it.

Drills

Answer fast — trust the rule.

quick drill

You committed on your laptop. Can your teammate see it on GitHub yet?

quick drill

What does origin usually name?

quick drill

Which command downloads Sprout's packages onto a freshly cloned machine?

quick drill

What is a pull request for?

Remember

  • Push to share, clone to join, pull request to propose.
  • The flow: clone, branch, commit, push, PR, merge.
  • Trap: a commit is local until you push, and a fresh clone must fetch its packages.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainA teammate's first change

A friend wants to add a dark theme to Sprout, which lives on GitHub. Describe the full flow from getting the code to the change landing on main, including the command that fetches the packages, and why they should use a branch and a pull request.