OSS-Contribution icon indicating copy to clipboard operation
OSS-Contribution copied to clipboard

Better workflow

Open moshez opened this issue 4 years ago • 3 comments

Hi! I wanted to discuss this before opening a PR.

This is not the workflow I use, and not the one I would recommend. If you do this, your master branch will fall behind upstream master, and you will have to play tricks to update it which are, in general, a pain and give little value.

Instead, I reverse the step.

I git clone from upsteam: git clone [email protected]:catalinpit/OSS-Contribution.git.

I create the branch with git checkout -b my-branch, and do whatever changes I need.

Only then do I fork, and then add a new remote:

git remote add mine [email protected]:moshez/OSS-Contribution.git

Then, I push the changed branch to mine:

git push --set-upstream mine my-branch

(After that I open a PR as detailed currently).

What is the advantage?

Often, it will take some time for your PR to be considered. This means that one of the comments you might get is "your code is out of date with master". In that case, you just

$ git checkout master
$ git pull --rebase
$ git checkout my-branch
$ git rebase my-branch

With the suggestion you have here, you would need to add a new remote upstream, and then either push changes from master to upstream, or git rebase my-branch upstream/master, neither of which are that intuitive.

moshez avatar May 12 '20 14:05 moshez

(For people who read this: this is also a good example of open source contribution workflow: if your contribution is non-trivial, it is often a good idea to open an issue and discuss the change before directly opening a PR.)

moshez avatar May 12 '20 14:05 moshez

This is interesting. I never thought about this.

Thank you for the information. Open a PR if you wish. :-)

catalinpit avatar May 13 '20 06:05 catalinpit

@moshez I tend to follow what it says on the code-of-conduct.md and contributions.md first if the repo has them (generally opening an issue and getting a task, so far), else I do the same. The only difference is when I'm doing more than one commit, then I prefer to draft the PR pending review, some repos seem to lose track of what they merge easily. I found that doing this is the minimum I can do to show respect for their work. It's still a bit confusing at times to understand how each repo works, this seems to be making it more relaxed and pleasant for everyone, at least for the time being...

ghost avatar Dec 28 '20 03:12 ghost