Im Working on Collaborative projects on github many people are working on it there is a origin source and a modded source but since modded source is a fork of origin source modded i cant both have origin and modded sources as a fork so i have the modified one as fork and i want to add origin as a branch Help Please
Git Collaborative Development
262 views Asked by Learath2 AtThere are 2 answers
Welcome to Stack Overflow, Learath2. I'm afraid it's really hard to work out what you mean by your question, partly due to the lack of punctuation, and partly because of the (unintentionally) confusing terminology you're using. However, I'll have a go and guess that:
- by "origin source", you mean "the original repository hosted on github"
- by "modded source", you mean "a fork of the original repository, also hosted on github"
- when you say "i have the modded one as fork", you mean "I forked the second repository on GitHub"
I'll also assume that you've cloned your fork of the second ("modded") repository locally to work with. That will mean that what you refer to as the "modded" repository is now referred to by the remote origin
. (Remotes are like nicknames for repository URLs.) That might be a bit confusing, given that you're referring to the original repository as origin
, so let's rename that:
git remote rename origin modded
Now let's add another remote for the original repository, calling it origin
.
git remote add origin [email protected]:original-repository-or-whatever.git
After that, you can fetch all the branches from that repository with:
git fetch origin
If you want to work on code from that repository's master
branch, you'll need to create a local branch based on it, which you would do with:
git branch --track original-master origin/master
Now you can switch between the two local branches with:
git checkout master
# (switch to the branch based on the master branch from "modded")
... and:
git checkout original-master
# (switch to the branch based the on master branch from "origin")
I hope that's of some help.
Somethat like that? This will add the original github repository as a remote to your local one and then you checkout the remotes master branch as the branch
original
.Its more or less an example. The first command is the important one. I dont know, what you want to do exactly, but with the remote added you should be able to do everything interesting.