Reputation: 49
I've bought a Unity Asset and it comes in form of source codes and I've changed it to meet my needs better.
My problem is that I need to be able to get the future releases and merge it with my own modified version.
I'm using my own modified version in Git, and was wondering whether if there's any way to get the new modifications without need to manually deal with merges, hunks, and other related stuff.
I've read about fork but not sure if I can use it here.
Upvotes: 2
Views: 712
Reputation: 15620
The key here is to simulate a remote repository with the original code versions.
In order to do that, extract a copy of the source code you received, cd
to that directory and git init
it. You'll have a fresh new repo.
Without touching (ie, compiling) anything, run git checkout --branch upstream
to create a new branch and git add .
to add all the code to the index. Then git commit
it, writing some message saying that's the original source code you received, and include it's version if it has any.
After this, git checkout --branch master
for creating master
branch, and do your modifications there. Make as many commits as you need/want - that'd be your working branch.
Whenever you get new versions of the third-party code, git stash
any non-commited changes you have, and then git checkout upstream
to go back to the latest release you had. Copy all the files you received there - I'd try to git rm
every file in the repo first, and then copy and git add
the new files, in case they've removed anyone - and then git commit
the new version. Once this is updated, git checkout master
and git merge upstream
so you include all the changes on your working branch.
You should git merge
or git rebase
any other branch you may be working on to include those updates. Also, you may want to do the merge (or a rebase
) with the updated upstream
branch in a separate branch so you can test your project in case the update broke any of your changes.
But the key idea is that: have a branch that acts as if the source code was git-versioned, and base your work on that.
Upvotes: 1