Rebasing a core repo in git
I have a customized fork of CodeIgniter that I use as a standard baseline for several projects. Recently, I've made significant improvements in this repo that I want to use to update the client projects that use it. What I can't seem to figure out is how to pull in the changes to a client project.
So I have:
Baseline:
A--B--C--D--E
Client cloned @ C
C'--D'--E'
And I want to update the client repo to E from the Baseline project.
I've tried rebase, and it has erased the files not present in the baseline project (views and such), and creates a bunch of conflicts that really don't ne开发者_JAVA技巧ed to be conflicts with things like the default HTML5 boilerplate that I use.
Is there an option for rebase that I should be using? Is there a different way to approach it? Do I need a bunch of .gitignores for the content directories?
You should probably start looking into merging instead of rebasing.
First of all, you should think in terms of branches, instead of repos. A fork is just a branch derived from another branch. The two have an ancestor in common (a commit) and that's what allows you to do all the nice git magic.
If i understand correctly your situation is more like
(origin/master)
A--B--C--D--E
\
\
\F--G
(local/master)
and you want to have commits D--E
in your local branch
, amirite?
Then you either have to git rebase origin/master
, or git merge origin/master
.
Think of it graphically and it'll be a lot easier.
And yes, you should most definitely read some more about git's branching model :)
精彩评论