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

9 views
Skip to first unread message

Jason Hsu, Ruby on High Speed Rails

unread,
Aug 28, 2018, 11:10:37 AM8/28/18
to Ruby on Rails: Talk
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?

Colin Law

unread,
Aug 28, 2018, 11:16:46 AM8/28/18
to Ruby on Rails: Talk
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

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/dd563618-24c8-408c-b0aa-12a41f50bdf5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jason Hsu, Ruby on High Speed Rails

unread,
Aug 28, 2018, 12:09:36 PM8/28/18
to Ruby on Rails: Talk
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?

Colin Law

unread,
Aug 28, 2018, 12:18:07 PM8/28/18
to Ruby on Rails: Talk
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
<jhsu8...@gmail.com> wrote:
>
> 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?
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3d9a72df-4230-4f5b-af17-50d571f4ae6f%40googlegroups.com.

Jason Hsu, Ruby on High Speed Rails

unread,
Aug 28, 2018, 12:29:38 PM8/28/18
to Ruby on Rails: Talk
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.

Colin Law

unread,
Aug 28, 2018, 12:54:08 PM8/28/18
to Ruby on Rails: Talk
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

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/35b9e2ab-f9e1-499a-b895-31dc708d1183%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages