Open source contribution (PR), simultaneously

patarapolw profile image Pacharapol Withayasakpunt ・1 min read

So, I thought making an open source contribution is as simple as forking and making a Pull Request; then wait for merging.

I was too naive. Merging might take time from multiple code reviews / corrections. During that, several things may happen.

  • The preforked upstream is updated.
  • You want to make another pull request unrelated to the old one.

My experience was pretty much sum up here.

Comment for #737

I still have one PR pending. How do I manage another one? Just overwrite the old PR?

What I actually did,

git remote add upstream git@github.com:umputun/remark42.git
git fetch upstream
git switch -c readme-for-devs upstream/master 

The actual steps are a little different as I used VSCode's GUI.

So, my recommendations are

  • After forking, always make a branch. Don't edit / merge master branch directly.
  • If things get problematic, set upstream to the preforked branch.
git remote add upstream <UPSTREAM_URL>
  • You mostly have only seen origin right? Alternative names such as heroku, staging, or upstream can also be used.

  • To update your master branch to be up-to-date with preforked,

git fetch upstream
git pull upstream master
  • To fork directly from upstream's master branch,
git switch -c <YOUR_PREFERRED_NAME> upstream/master
  • My thought is also, I can manage multiple unrelated updates this way too. (such as partial monorepo changes, or some commit-type-specific changes.)

Anyone has an experience to share as an open source contributor, about best practices in Git and GitHub?

Posted on by:

patarapolw profile

Pacharapol Withayasakpunt


Currently interested in TypeScript, Vue, Kotlin and Python. Looking forward to learning DevOps, though.


markdown guide