Skip to the workspace
Pebellslearn by building
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.

flutter / GitHub: Sharing Sprout

Explore each scene at your own pace.

01 · The rule

The rule

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
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.