If the upstream project does not accept your modifications, maintaining a small set of patches as a compatibility layer is still better than making all your changes directly in the upstream code base. Your problem-specific plugins would live in a completely separate project. Once those changes are in the upstream project, you can implement your changes without having to touch the upstream code, which significantly reduces your maintenance burden. ![]() This could mean setting some options in a configuration file, adding a plugin system, hooks and callbacks for certain events, or introducing dependency injection. The best strategy in the long term is therefore to make small changes to the original code to make it more configurable. While your problem-specific adaptions do not have any value for the original project, making it more configurable certainly would. This problem becomes a lot easier if the original code base is sufficiently configurable so that you don't have to edit the code in order to implement your changes â in OOP speak, it should obey the open/closed principle. cd MyProject git checkout -b todo-feature git pull origin todo-feature We can see above that we have moved into our project directory. git pull Thus, we need to execute the following commands to pull from the specific remote branch todo-feature.This is not because Git is a bad tool, but because this is an inherently difficult problem. The syntax of the git pull command is below. The term âversion controlâ is slightly misleading here. However, Git is not a suitable tool to manage different modifications of a code base. Merging instead of rebasing also reduces your work load in the long run. Doing the merge manually will give you more control. A git pull upstream master is almost the same as git fetch upstream git merge upstream/master. If you need to keep your current workflow, it might be better to stop your main branch from tracking any upstream branch, and handle all merges manually â so effectively the commands you are suggesting. ![]() Rebasing also ârewritesâ history which means that merging your branch becomes absolutely impossible. That means resolving the same conflicts again and again. Since your adaptions are never merged back into the upstream repository, each time you rebase you will have to rebase everything you've ever done. Rebasing your changes onto the current state of upstream is not a viable solution in the long term, especially if your changes are more than a handful of commits. At some point, there will likely be conflicts, and you will need to resolve them manually. There is no easy way to get updates from upstream while maintaining local changes to the code base.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |