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

  • SEARCH
  • Home
  • 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 7014271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:29:58+00:00 2026-05-27T22:29:58+00:00

I have a github private repository, in which I have been working with a

  • 0

I have a github private repository, in which I have been working with a few other (private) collaborators. Let’s call it repo-a.

A client just added me to their Organization account. I need to essentially share my repo-a with other developers in that Organization. I am not sure whether “share” is the right term here; maybe I need to “copy”? How do I go about doing this?

The more important issue that I hope someone can help is I don’t want the Organization to see the history committed by my private collaborators. But, hopefully, I will be able to easily “push” the latest code in repo-a to the Organization (I am still planning to work privately with the repo-a collaborators). Is this reasonably possible?

  • 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-05-27T22:29:59+00:00Added an answer on May 27, 2026 at 10:29 pm

    Short answer: no, it’s not reasonably possible.

    You’re setting yourself up for a lot of trouble here. If the history you give them doesn’t contain the actual history, then by definition you have no record of what commits their version includes. No matter what, you will never be able to push from a branch that includes the “private” commits to one that doesn’t. You’re basically asking to have history that looks like this:

    - W - X - ABCD - Y - Z - EFGH - ... (public)
           \              \
            A - B - C - D - x - E - F - G - H (private)
    

    where ABCD is a commit containing the changes of commits A, B, C, and D, and similarly EFGH hides away E, F, G, and H. You can do this using git checkout public-branch; git merge --squash private-branch. A squash merge performs the merge, then records it as a regular commit, i.e. without the merged branch as a parent. This option might work for you, as long as you’re very careful with the merging. It’s still a pain, though. (Note that merging Y and Z results in duplicate commits in the private repo, ABCD vs A-B-C-D. This is ugly, but better than the alternative, which is completely divergent history.)

    So no matter what, your history will diverge. The best case is probably for you to use tags to help yourself keep track of things. For example, you could tag commit D as private-0001 and commit ABCD as public-0001, commit H as private-0002 and commit EFGH as public-0002. That would at least let you have some record of how the separate histories are tied together. You can never actually merge any of the private commits into the public branch, since commits bring with them their ancestors.

    So I’d recommend finding another way. There are several options, depending on your reasons for wanting these contributions kept private:

    • Abandon your plan, and make the private contributors public.

    • Have the private contributors commit in your name, or using fake names. (Have them set user.name and user.email in the .gitconfig of this repository.) If all you’re trying to do is keep them anonymous, this would be sufficient and painless.

    • Do it halfway. Looking back at the first diagram, after you do your squash merges, have all the private contributors reset to that point (rebasing any other branches they might have). Every time you publicly publish, you essentially throw away the private commits, and regard the squash-merge commit as the new truth. This will require vigilance on your part, making sure the other contributors do what’s required, but it would spare you the baggage of all that crazy history. (If someone fails to reset, it is fixable. Suppose they made commit E on top of commit D instead of commit ABCD. They could use git rebase --onto commit-ABCD commit-D to transplant their branch where it belongs.) Your history would end up like this:

      - W - X - ABCD ------------------ Y - Z - EFGH - ...
         \                               \
          A - B - C - D (abandoned)       E - F - G - H (abandoned)
      

      The benefit of this is that you never have any horribly gnarly merges spanning a lot of history, and you don’t drag around any baggage in the form of extraneous merges or duplicate commits. If you publicly publish the private contributions infrequently enough, it wouldn’t even be that painful. You could even let things get a little asynchronous if you’re careful, for example:

      - W - X - AB - X - CD - Z - ...
            |\
            | A - B (abandoned)
             \
              C - D (abandoned)
      

      Just be very, very careful to keep track of what you’ve squash-merged. Besides tagging as I discussed earlier, you could also have your squash-merge commits include a list of short SHA1s and commit subjects from the merged commits.

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

Sidebar

Related Questions

I have a private repository in github that has 5 collaborators.Now when the collaborators
I have a project which has the codes in github (a private repo), I
I have repository on GitHub to which I commit regularly from my local computer.
I have a project on github that I have been working on before. However,
I have a private repository on Github that I want to use. I deploy
I have setup a private repo from a windows machine to GitHub. I am
I have a local Git repository I've been developing under for a few days:
I have a project on a private github repository (but this should work for
I have added a new GIT repo (private github repo) to Eclipse EGit repo
I have a project on GitHub behind a private repository. I want to make

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.