Contributing to pyrevit the proper way

Hi,
The question is most probably for @eirannejad. And my question might feel simple or stupid to git addicts, but that might serve others new to code people.

I start by forking the pyrevit git.

From my fork, I create a branch with a name that states what I am working on (should I branch in the first place?)

I create new stuff, modify some existing ones, then commit to that branch.

After that, I create a Pull request aimed towards the pyrevit source repo… But I never know which branch to PR it to: master, develop, feature…

And if I keep on doing some mods, but to some other tools, topics, I tend to branch again but from my previous branch. Is that a correct way of doing it?

So the more general question:

@eirannejad
how would you like people to contribute to pyrevit in terms of git workflow so that it makes maintaining easier?

@Jean-Marc Thanks for posting this question. You have most of it figured out:

If you want to contribute to the project, then:

  • Fork the pyRevit repo under your own account
  • Clone the fork on your machine (origin remote points to your fork)
  • Checkout the develop branch and build the project. Look at the help on dev/pyrevit.py script
  • If you need to make your custom changes to pyRevit that are not going back to the main repo, then create a custom branch for yourself e.g. dev/my-pyrevit
  • Here is how I’d approach the branching. Let’s say you found a bug that your want to fix on your side and push to the main pyRevit repo as well:
  • Create a branch (from develop) for the work on fixing this bug e.g. issues/788 (# refers to the issue number on github, or issues/some-bug)
  • Fix the issue and commit
  • Merge this branch into develop and push to your fork
  • Create a PR from develop of your fork, to the original pyRevit develop. Github web interface makes this very easy
  • It might take me a while to merge your PR into the repo, but meanwhile you have the fix on your local clone and your fork
  • Then if you have your own dev branch, merge the issue branch into your dev branch as well so you have the fixes.

Now if you want to stay updated with the changes the pyRevit, then you need to periodically pull the changes from the original pyRevit repo (forks of a repo do not automatically synchronize). If that is the case then add a new remote to your clone and call it upstream and set it to the original pyRevit repository. When you want the new changes, pull from upstream/develop into your develop and it will bring all the commits that are missing from yours.

All of this sounds daunting especially if you are using git on the command line. I highly advise using a git GUI like Fork or any of these that you are more comfortable with.

3 Likes