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.
originis the usual name for the main one. pushsends your commits up.-uremembers the link, so later a plaingit pushis enough.pullbrings 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