Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git maintaining 2 versions of the same project, with different users on each

Tags:

git

github

I have a (private) project in github where a team of developers commits changes. A client has now asked to develop some heavy customizations on their own copy of the system. A new team will be working on this project, but I don't want this team to have access to the original repository. So I created a new repository on github, and initialized it with the code from the original project.

However, I still want the 2nd project to get the updates done on the original project. How can I setup the repositories to meet this need?

Alternatively, if I am to keep a single project, is there a way to have the new team only access a specific branch on it?

like image 322
periklis Avatar asked Apr 10 '13 10:04

periklis


People also ask

Can I clone the same repository twice?

Simply clone your project's repo twice (or even more often). When your work on a feature branch is done, simply push that branch and check it out on your 2nd copy to run tests there. You can pick up a new story and work on that on your "main" project directory.

Can two people work on the same file in Git?

Yes, that is no problem at all since each clone is a branch or what you want to call it of the complete repository. Multiple please can work on the same file in GIT, it just has to be merged by the second person making a commit or push of the code.

What happens if two people push to Git at the same time?

If server detects a conflict when someone pushes data (and if two users are doing this "simultaneously" one of the pushes will be conflicting, because it will be applied only after the other one completes), the server will reject it, and the unlucky user shall then resolve conflicts and try to push again.


1 Answers

I have followed the recommendation on this site. I'm repeating the process here for anyone interested: Let's assume that the original project is checked out in projectA and the derived project in projectB:

The first time I did:

 cd path/to/projectB
 git remote add orig_project path/to/projectA 
 git fetch orig_project
 git merge orig_project/master -X theirs
 git push

Now every time I need to synchronize changes from projectA to projectB, I do:

git fetch orig_project
git merge orig_project/master
git push

orig_project can be anything. I used -X theirs the first time, because otherwise all fetched changes conflicted

like image 154
periklis Avatar answered Sep 18 '22 13:09

periklis