blog icon indicating copy to clipboard operation
blog copied to clipboard

Use git and GitHub to contribute to a project in a team

Open qingquan-li opened this issue 2 years ago • 0 comments

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

GIt-Workflow-Diagram (source: http://www.davidgw.com/git-workflow-model/)


Steps

  1. 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
  2. git clone your forked(origin) repo to local

  3. Specify the remote upstream(original) repository that will be synced with the fork: git remote add upstream <repo-url>

  4. git checkout -b a new feature branch

  5. Update the code and git commit

  6. Fetch and merge the code from upstream/dev: git pull upstream dev

  7. git push the modified code

  8. Create pull request on GitHub, origin/feature -> upstream/dev

  9. Code review on GitHub

  10. Merge pull request on GitHub


Example

Manage project with git:

git commands

Create pull request on GitHub:

create pull request

Code review on GitHub:

code review

Merge pull request on GitHub:

merge pull request

qingquan-li avatar Sep 26 '22 23:09 qingquan-li