I created a project as a single file gist. Then I expanded my project to multiple files (by, for instance, adding README and LICENSE files). I set up two remotes on my local git repository now, which I call origin-gist and origin-github. I can push to them and everything is right with the world.
But what I actually want is for the gist to remain just the single file, without the overhead of the added stuff. How can I do that while keeping one local repository that pushes to the two remotes?
As an aside, if I could control the order that the files displayed in gist I would care less. I'm also unwilling to rename my files to induce the desired order with an ASCIIbetical sort.
Any tips?
I found information in this question useful: Transfer gist repo to github, but need some clarification.
The easiest solution is probably to keep two separate branches, one with only the script (which I would name
minimal
) and one with all the extra files in it (master
). Then make sure the "upstream" for each branch is set properly:After that, you just need to make sure that both scripts stay up to date, so any change you make to one branch should be made to the other branch as well.
You can make this easier in one of two ways:
cherry-pick
commits from one to the other.merge
themaster
branch into theminimal
branch whenever you make changes, it will add those extra files tominimal
. But assuming theminimal
branch only contains the actual script, you should be able to safely merge fromminimal
intomaster
without adding those extra files:This answer doesn't directly answer the specific question you asked, but it does solve the problem at hand, and has therefore been added as an answer rather than a comment.
It is worth asking yourself, is there a reason to keep the old gist around and updated?
The easiest solution to this problem, and what I frequently see, is the gist replaced with a README document that says something like:
Take this "former gist" as a prime example: https://gist.github.com/weakish/492755
This way people who find the gist online can be directed towards the newest version of the library, and you don't have to worry about keeping both separate locations up to date.