blog
blog copied to clipboard
Use git and GitHub to contribute to a project in a team
References:
- https://docs.github.com/en/get-started/quickstart/contributing-to-projects
- https://www.freecodecamp.org/news/how-to-use-git-and-github-in-a-team-like-a-pro/
- https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
Git Workflow
(source: http://www.davidgw.com/git-workflow-model/)
Steps
-
Fork the owner's repo (upstream)
The original(owner) repo should include 2 branches: main(master), dev
- main(master) branch for production
- dev branch for development
-
git clone
your forked(origin) repo to local -
Specify the remote upstream(original) repository that will be synced with the fork:
git remote add upstream <repo-url>
-
git checkout -b
a new feature branch -
Update the code and
git commit
-
Fetch and merge the code from upstream/dev:
git pull upstream dev
-
git push
the modified code -
Create pull request on GitHub, origin/feature -> upstream/dev
-
Code review on GitHub
-
Merge pull request on GitHub
Example
Manage project with git:

Create pull request on GitHub:

Code review on GitHub:

Merge pull request on GitHub:
