1

For simplicity's sake, let's say I'm maintaining a fork of Bootstrap. My changes are specific to my theme, so they'll never be merged back into the original Bootstrap project, but I still want to make sure that my project has the latest changes. Over the life of the project, I'll merge in Bootstrap's changes several times.

What's the appropriate way to add in Bootstrap's changes to my fork knowing that I'll be doing so multiple times throughout the life of the project? Would constantly rebasing create issues later down the line, or would that always be the most appropriate option (assuming I want 100% of the changes in Bootstrap). How would I approach a situation where I only wanted some of the changes? Would this prevent me from rebasing in the future?

1
  • You could cherry pick in individual upstream commits, but as your fork diverges it will become harder (and perhaps eventually impossible) to adopt the parts you want.
    – jonrsharpe
    Commented Jan 28, 2017 at 20:03

2 Answers 2

1

If you have only one machine with the fork then rebasing is an option. However if your fork have more than one machine hosting it (for example, if you share it with another developer or if you have it on Github - remember Github server is also a machine) then you should not rebase, merge instead.

Rebasing changes past git history. Git has no simple mechanism to pull past history. Which means that once you do a rebase and push it everyone else cannot do a pull. Instead they must delete their local copy and clone again.

So the rule of thumb is simple: you can only push a rebase once when initially pushing the branch. After that rebasing will screw up the repo.

1

You might be able to rebase your own changes on top of the current Bootstrap release depending on how you plan to release your changes. Rebasing the other direction (the original repo on top of your changes) will be nearly impossible.

In either direction, merging is almost certainly the best solution.

To select individual commits, or a range of commits, use git cherry-pick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.