Apply source code updates after Fork time and multiple changes

Asked

Viewed 74 times

0

I have a situation where we use a system that the code is open source, but we made some modifications to fit our need.

Now the original system has undergone code changes to improve security, I’m looking at their commits and implementing the changes in our system.

Is there a tool, maybe even in git itself, where I could make a comparison, that in case I took the code of the day I gave Fork in their code, my current code and their current code and made a comparison, sort of returning a union code of my and theirs changes?

  • Not in this magical way, but git merge can be used to make a semi-automatic merge for you between different branches.

  • You actually created a Fork from the original repository and started uploading the changes to Fork? Or just downloaded the source code and started using it in the project (without creating your own Fork on github)? Just to be sure...

  • I created a Fork of the original code, and then made my own commits in mine

  • I find nothing so magical, it would be a tool that would go through and isolate all the differences of the two codes in relation to the original and then indicate everything in a single, indicating areas of conflict and indicating which is which

  • Something I think I’ve even seen something in some article or report around, but I can’t remember where

1 answer

1


First, you have to ensure that your git repository is an extension of the original project, that it is a Fork and not just a copy. Even if you copy, it is usually to come a folder called .git that contains the necessary information of what we call origin.

Therefore, you will first need to add a remote pointing to the repository where the changes were made. You can see how it’s done from the git website https://git-scm.com/docs/git-remote

git remote add <name> <url>

After that, you’ll have a remote to perform all the git functions like git fetch git pull git checkout.

With this prepared, you will use the git cherry-pick. According to the documentation:

Given one or more existing commits, apply the change each one introduces, Recording a new commit for each. This requires your Working Tree to be clean (no modifications from the HEAD commit).

By accessing the documentation you can see exactly how the tool should be used:

https://git-scm.com/docs/git-cherry-pick

  • I’ll test it tomorrow, but I think that’s exactly what I need

Browser other questions tagged

You are not signed in. Login or sign up in order to post.