exterminator
exterminator

Reputation: 260

Track my changes in a 3rd party git repo and push the changes to my personal repo

There is a 3rd party git repo and I have forked it and I am maintaining my changes. These changes are done in a released branch so there wont be any conflicts. Whenever the 3rd party repo releases a new version then I have to do the changes on top of it and I should maintain it in my repo. Therefore I wanted to know whether we can achieve below requirements through git.

1) I don't want to use the 3rd party repo as a library rather I wanted to use it as my project but I don't want to fork the repo rather I should be able to tag which 3rd party repo I wanted to change. - This is because if I fork the branch whenever the 3rd party does a releases then there would be merge conflict within branches of my git repo.

2) maintain only the changes what I have done to the project and push only those changes to my repo and I dont want any thing to be pushed into the 3rd party repo.

3) When I clone my repo then in the local repo it should have files from both 3rd party and my changes but in my git repo it should only have the diff that I have to the 3rd party library.

The reason for me todo this is to track my changes between different released version of 3rd party repos.

Upvotes: 1

Views: 625

Answers (2)

Marina Liu
Marina Liu

Reputation: 38116

You can add the 3rd party repo as a "folder" for your repo. And when the 3rd party repo has new version, you can treat it as a sub repo either, then you need to pull from remote and update in your repo. In order to illustrate clearly, let’s assume the name of 3rd party repo’s name is 3rd_repo, the name of your repo is my_repo.

You can follow these steps: Bash on local my_repo -> clone 3rd_repo here -> git add 3rd_repo/ and commit -> make changes in 3re_repo -> commit in my_repo/ directory -> push to remote my_repo. Detail steps can refer here

From these steps, you can make changes for 3rd_repo and push the changes to my_repo. Also when you clone my_repo, it has the modified files of 3rd_repo. If 3rd_repo has new version on remote, you should do:

cd 3rd_repo -> git commit -> git pull -> (solve conflict if has and) make changes -> cd.. -> commit in my_repo/ directory -> push to remote my_repo.

Upvotes: 1

Vy Do
Vy Do

Reputation: 52626

This is my proposed solution for you. I tried sub-module success, but sub-module as a mirror repository I have no real experiment.

  1. Create a repository has one/many sub-module (https://github.com/blog/2104-working-with-submodules)

  2. Sub module is mirror repository (https://help.github.com/articles/duplicating-a-repository/)

Upvotes: 1

Related Questions