Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9008333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:54:51+00:00 2026-06-16T01:54:51+00:00

I have a repo on GitHub called foo with the following branches: master gh-pages

  • 0

I have a repo on GitHub called foo with the following branches:

  • master
  • gh-pages

I have a second repo on GitHub called <username>.github.com (a user repo) with the following branches:

  • master
  • source

I would like to use the code in foo->master in <username>.github.com->source and be able to merge in changes from foo->master when they occur.

What is the best means of achieving this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:54:51+00:00Added an answer on June 16, 2026 at 1:54 am

    You can just add foo/master as a remote, merge it in from time to time (do this in <username>.github.com repo):

    # add foo as remote (once)
    git remote add foo https://github.com/<username>/foo.git
    # fetch from remote (often)
    git fetch foo
    # merge changes to source (when you want)
    git checkout source
    git merge foo/master
    

    You can set origin/source as remote for source and origin/master as remote for master as normal.

    You can also use git fetch --all to update all remotes, including origin and foo.

    If you don’t change much in source, then the merge will almost always be fast-forward.


    You might want to set a remote url for foo that is read-only.
    This way you can’t push from <username>.github.com by accident and if it’s a public repo, you won’t need authentication (or password for your ssh key) for the fetch.


    You can keep git from fetching the gh-pages branch with

    git config remote.foo.fetch "+/refs/heads/master:/refs/remotes/foo/master"
    git branch -rD foo/gh-pages
    

    You just have to remember setting that when you expect any other branches than master to appear from foo remote.

    A good explanation of the refspec is in the git book

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a repo called stuff. git@github.com:mine/stuff.git when I do a git
I have one repo hosted at https://github.com/aikiframework/json . On my local copy, I added
I have a git repo which has a few branches - there's the master
I have a repo on GitHub. Recently I have discovered GitHub's pages and I
I issued the following pull to our GitHub repo... L.MVC4 (master *)$ git pull
I have a repo on GitHub that I want to open source. Before I
I have a repo on GitHub with a single branch master that I've been
I'm working on a backbone.js project and I'm calling my github repo. I have
Suppose that: I have a repo called MyRepo. I have uncommitted changes in my
I have a git repo with a dev and a master branch. Now I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.