25

There is a project on Github that I mostly like and want to use. There are a few things I want to do differently/remove that doesn't make sense for what I want/need. Also I want to add a few things as well.

As I understand it, I should fork the project and I can make whatever changes I want and push back to my fork. From there, I also want to occasionally pull into my fork the changes from the original project so I get the latest bug fixes/features.

Am I off-base of how I think it should work? How would bring in the changes from the original project?

Mike Wills
  • 393
  • 4
  • 11

2 Answers2

18

Make the fork, then make a branch immediately.

Now you have an "untouched" master that can be updated itself going forward to get the latest changes with git pulls.

Keep you branch local without pushing to remote and you can do rebases which will do the following for you:

  • save away your changes
  • apply the latest changes from master to your branch (the ones that came from the update from the remote)
  • reapply your changes again, on top of the code that was updated from master (or other original branch).

When you are finally done with it, merge it back into master (or whatever branch the initial fork was from) locally and then submit the pull request for the actual owner to pull it in.

That's one workflow (or "forkflow") anyway, as I understand it. Others are welcome to comment or correct or add more detail.

svick
  • 9,999
  • 1
  • 37
  • 51
Michael Durrant
  • 13,101
  • 5
  • 34
  • 60
  • 3
    This does seem a bit off-topic. It addresses the 'how' without much explanation of what you're doing, and avoids getting into the etiquette question. You could improve this by giving a high-level overview of what you're accomplishing, and explaining why it's good manners to do it this way. – Justin Morgan Jun 21 '12 at 05:27
10

You basically have it: once you create a fork, it's your own little sandbox.

I think the main thing that you need to do is immediately create a branch after you fork, in order to keep the original line of development separate from your own. Whether you develop in this branch or in master is largely a matter of personal taste. The one thing that would keep me from developing in master is that it's too easy to do a "git pull" and get the wrong thing.

parsifal
  • 101
  • 2