Git forking: adding elements to my personal repository but not the original

As you know, a way to contribute to a project without being a collaborator is to fork a project, create a branch, make the changes in your new branch, and submit the new branch as a pull request.

There are certain things I’d like to add to a project (like Bash scripts and the annotate, rails-erd, and railroady gems), but the project collaborators don’t want them. I understand now that they don’t expect me to suck it up and do things their way. Instead, they want me to keep those features on just my own personal branch but push other changes.

How do I go about doing this? Do I make the changes to my personal fork’s master branch or a different branch? When the upstream repository is updated, how do I update my personal branch to incorporate these changes WITHOUT wiping out my personal features?

On Tue, 28 Aug 2018 at 16:10, Jason Hsu, Ruby on High Speed Rails

As you know, a way to contribute to a project without being a collaborator is to fork a project, create a branch, make the changes in your new branch, and submit the new branch as a pull request.

There are certain things I'd like to add to a project (like Bash scripts and the annotate, rails-erd, and railroady gems), but the project collaborators don't want them. I understand now that they don't expect me to suck it up and do things their way. Instead, they want me to keep those features on just my own personal branch but push other changes.

How do I go about doing this? Do I make the changes to my personal fork's master branch or a different branch? When the upstream repository is updated, how do I update my personal branch to incorporate these changes WITHOUT wiping out my personal features?

The technique I use is to make my personal changes on a branch. Then when the master is updated you can rebase the branch onto the tip of master.

Colin

Let’s say that the project I’d like to work on is other_user/project1. I clone this project, and my version is myself1/project1. How do I proceed?

Exactly how you do it depends on where the repository is. Are we talking github? Which bit don't you know how to do? If it is basic git operation help you need then there are many tutorials out there.

Colin On Tue, 28 Aug 2018 at 17:09, Jason Hsu, Ruby on High Speed Rails

Yes, I’m talking about GitHub. I know how to fork a project. I can create a new branch and then submit the branch as a pull request.

What I’m not clear on is how to add elements to the project (like the Bash scripts and Ruby gems) to my version of the project, submit a pull request that omits these particular personal elements, and update my version of the project from the original WITHOUT losing my personal elements.

On Tue, 28 Aug 2018 at 17:29, Jason Hsu, Ruby on High Speed Rails

Yes, I'm talking about GitHub. I know how to fork a project. I can create a new branch and then submit the branch as a pull request.

What I'm not clear on is how to add elements to the project (like the Bash scripts and Ruby gems) to my version of the project, submit a pull request that omits these particular personal elements, and update my version of the project from the original WITHOUT losing my personal elements.

OK, create your working branch and add your personal bits. You will never issue a PR using that branch. To update your repository when there are changes in the original see https://help.github.com/articles/syncing-a-fork/ Then with your branch checked out you can do git rebase master to move your bits to the tip of master. Obviously if the working branch on the main repo is not master then rebase to that. It gets a bit fiddly if you want to issue a PR, I have done this by starting a new branch on my personal branch and making the changes there. Once that is all working rebase that branch onto master so you can issue the PR.

Colin