0

I wish to publish a Git repository's master branch (containing simulation codes for an accepted peer-reviewed paper) but not disclose work that has been done on separate branches as part of ongoing research. Eventually, that work will be published (at which point I would merge it to master).

I'm fairly sure this can be accomplished by following these steps:

  • create a new repo,
  • locally set up the private original repo as a remote, say secret,
  • git pull secret master,
  • set up the origin remote that is publicly available,
  • git push -u origin master

However, I have heard one too many horror stories about clear-text passwords that turned up in public Git repos etc. and seek confirmation from someone who actually understands the inner workings of Git that the information from the other branches is indeed not contained in the public repo.

In case that's relevant (though I don't think it is), the public Git repo will be hosted on either Github or our university's Gitlab instance.

Jonas Greitemann
  • 1,011
  • 10
  • 25
  • I would recommend putting all public code into a separate public repo. – evolutionxbox May 22 '18 at 09:37
  • @evolutionxbox Yes, that is what I suggested I was planning. The public repo would be separate from the private one for development. Still I would like to use the entire master branch, not just hard-copy files from the current `HEAD`, to preserve the commit history and be able to easily merge future work into the public version. – Jonas Greitemann May 22 '18 at 09:41
  • 3
    Create a local repository that you pretend is that public repository, then do your steps there. Then go to this new repository and try `git show XXX` where XXX is the hash of a commit you don't want in the public. If you get an error message it's not there, if you get content, it's there and you did something wrong. Pushing a branch should only bush the commits that are necessary to push the history *of that branch* though. – Lasse V. Karlsen May 22 '18 at 10:04
  • @LasseVågsætherKarlsen Good one. At the risk of seeming paranoid, I know of cases where information was still contained in the repo, even when not associated with any commits. If you could disperse these concerns and post your comment as an answer, i'll be happy to accept. – Jonas Greitemann May 22 '18 at 11:47

0 Answers0