seismo-learn/contributing

Update git workflow

Closed this issue · 1 comments

Reference:

Current workflow

Here is the current workflow documented in https://seismo-learn.org/contributing/pull-request/:

git clone git@github.com:seismology-freshman/seismology101.git
git remote add upstream https://github.com/seismo-learn/seismology101.git
git checkout main
git checkout -b pr-workflow
git add --all
git commit -m "Commit message"
git push origin pr-workflow
# open a PR
# after the PR is merged, contributors need to pull the upstream main branch and push to origin main branch
git checkout main
git pull upstream main
git push origin main    # this step is optional
git checkout -b pr-workflow-2

Better workflow

Reference: https://www.asmeurer.com/git-workflow/

git clone https://github.com/seismo-learn/seismology101.git   # Use HTTPS not git here!
git remote add seismology-freshmen git@github.com:seismology-freshman/seismology101.git
git checkout main
git checkout -b pr-workflow
git add --all
git commit -m "Commit message"
git push seismology-freshmen pr-workflow
# open a PR
# after the PR is merged
git checkout main
git pull origin main
git checkout -b pr-workflow-2

The new workflow looks very similar to the current workflow, but in the new workflow, the local "main" branch tracks the main branch of the remote "origin" (i.e., seismo-learn). So they can't push any changes to the remote "origin" branch, and they also don't have to worry about forgetting the git pull upstream main step.

I think upstream main equals origin main