1

I've a set of remote repositories that I commit the master branch to, including GitHub and some private ones.

I want to commit a specific configuration file (with private information) to only one of the private repositories. Aside from that, the commits to be pushed to the remote repositories are identical.

Should I create two branches in order to achieve this, or what's the canonical way?

Shuzheng
  • 11,288
  • 20
  • 88
  • 186

1 Answers1

1

If you are pushing the same branch to multiple repository, then yes, a separate branch dedicated to that one file is preferable, to avoid any mistake.
If that file does not depend on the history of other files, you might even consider an orphan branch, to isolate that file in its own branch.

But ideally, you should not push private information, especially in a setup where you are pushing to multiple repositories.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I need to push a `pip.conf` file to a single repo, since the environment doesn’t allow downloads from official index, and so custom index configuration needs to happen. Suppose I create another branch to host that file. How should I keep the code in both branches identical? I don’t think merge or rebase would work here? – Shuzheng Jun 17 '20 at 18:04
  • @Shuzheng Instead of trying to make both branches identical, I would rather, 1/ store the file alone in its branch. 2/ have a builkd script which test for that branch, and, if said branch exists, copy the file to the current working tree. (https://stackoverflow.com/a/60855504/6309) – VonC Jun 17 '20 at 19:42