简体   繁体   中英

Github Strategy/Remote Setup for Open Source Project

I have gotten a Github open source project at a good place to share with others (we'll call it Repo A). I'd like to copy the code into a new repo (white label it) called Repo B.

Recap

  • Repo A: custom copy of the code for a non-profit (the existing repo)
  • Repo B: white labeled copy of the code that will continued to be developed (does not exist yet)

I need advice on the following:

How can I set up the remotes on Repo B so that when a new feature is introduced on Repo B, I can have it update Repo A? I'm open to have to do this through continuous integration.

With git, having multiple remotes is just as easy as pushing to them!

After creating a repository at GitHub, you are kindly asked to add a "origin" remote to your local repository. ( Repo A )

git remote add origin git@github.com/user/repo.git

You can create as many remotes as you like! The synthax is always the same:

git remote add NAME URL

(See The git-remote man page for more information)

After adding Repo B as another remote, you can push the master branch from Repo A to Repo B .

Make sure, you've pulled and got the latest code!

# On the master branch
git checkout master

# Get the latest code
git fetch

# Merge the code from master at repoB
# to your local master branch
git merge repoB/master

# Push the local master branch to RepoA
git push origin master

This should exactly do, what you expect. Make sure to push other branches and tags as well!

(You might use the --mirror option when pushing)

Update 1 :

**Short recap **

  1. Clone repoA from GitHub
  2. If not already created, create repoB. (Either local or online, for example at GitHub)
  3. Setup the RepoB remote, using the URL of the Repo.

After this basic setup, you can repeat this:

  1. Pull everything from RepoB
  2. Push everything you like to RepoA

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM