Collaborate on a prototype - Store code online with GitHub and GitHub Desktop
When you store a prototype on GitHub, you can collaborate on your code with anyone in your team.
You can make a "branch" (a separate version) so it does not affect anyone else.
When you are ready to suggest your changes, you can make a "pull request"
to the main
branch. This will share your suggested changes
with the rest of the team for them to review.
If you are working on your own, you can make changes on
main
without using branches.
Create a branch
- In Github Desktop top bar, select Current branch.
- Select New branch.
- Enter a branch name and select Create branch based on 'main'.
Save and share changes
Make your changes to the prototype and save them in your code editor. Then you can share them by creating a "pull request".
GitHub Desktop will show you the files that have changed.
- In Github Desktop, bottom left, enter a summary in the box above the description (leave the description blank).
- Select Commit to branch-name
- Click Publish repository. This publishes your code to GitHub.
- If you make more changes, commit them and select Push origin.
Make a pull request
- Select Create a pull request. This tells other people about your new branch, so they can review and suggest changes. If you cannot see that button, select the Branch menu, then Create a pull request.
- Creating a pull request will open GitHub website. Write a title and description of your changes and select Create pull request.
Review a pull request
Another member of the team should review the pull request on GitHub.
They should:
- go to the Files Changed tab.
- select Review changes
When they have approved the pull request:
- go to the Conversation tab
- select Merge pull request
Download changes
When a pull request is merged, you'll need to update your version (also called "pulling" changes).
- In Github Desktop top bar, select Current branch.
- Select main.
- Click Fetch origin and then Pull origin.
- Select Open in Visual Studio Code to view the changes.
Dealing with conflicts
If 2 people edit the same file at the same time, it can sometimes cause an error in GitHub called a "conflict".
If there is a conflict, you must manually resolve the change. Ask a developer on your team to help.