Reputation: 43
I'm a bit new with git, and decided that I would jump right into it rather than giving myself a proper tutorial. After a month of working on a project, I've gotten myself into a little trouble. I decided at one point in time that I didn't like how a particular piece of code was turning out, so at that point, B, I branched to E, deleted the offending file, and recreated it as a whole new file. Obviously the best thing to do would have been to git rm instead of just deleting the file... I now need to rebase E to branch off of C, but am not sure how to manage that, because of conflicts with the rebase, since the file changes in both branches. My goal is basically to have the branch starting at E continue with the new file, but to incorporate the changes of C into the new branch. Any help in figuring out how to manage rebasing this, would be greatly appreciated.
A -> B -> C -> D
\
E -> F -> G
Upvotes: 4
Views: 901
Reputation: 2362
Your concluding statement tells me that what you are looking for is to merge the specific file in C or even better in D with the same file in G. This way you will have the new file as it has progressed from E to G including the changes you made in C which I presume are also in D.
Merging specific files between branches is possible. As I am not very experienced doing this I will refer you to a couple of links that describe how you can do it:
http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/
How do I merge changes to a single file, rather than merging commits?
I hope this helps.
Upvotes: 2