
I'm writing a Python script that checks git repositories in the user's home folder (other folders is an option that should be added soon) and then tells you their status, both local and remote. I want to release it publicly using github, but I'd like to maintain a private repo, and only push certain releases to github. I admit this is mostly because I keep extensive notes in the source code and am perhaps a bit embarrassed what those notes say both about my memory and my limited coding skills. I should probably just get over it - particularly since the code itself probably says more than the notes. But - git is flexible enough that I imagine that this is an option: has anybody done this? As my knowledge of Python is somewhat rudimentary, so is my knowledge of git. The only thing I'm fairly sure about is that rebasing will be involved. If I wasn't concerned about pull requests (as novel as it seems now, I like to hope they'll happen) this could be done in any number of sloppy ways. But it seems like I need either a branch or a separate repo (which, and why?) that includes only the github data, and I need my private repo to have the github one as a "tracked branch" or something like that that I can merge from. Is this making sense, or am I thinking about it all wrong? I welcome all suggestions and thoughts, thanks. -- Giles http://www.gilesorr.com/ gilesorr@gmail.com

Giles Orr wrote:
I'm writing a Python script that checks git repositories in the user's home folder (other folders is an option that should be added soon) and then tells you their status, both local and remote. I want to release it publicly using github, but I'd like to maintain a private repo, and only push certain releases to github. I admit this is mostly because I keep extensive notes in the source code and am perhaps a bit embarrassed what those notes say both about my memory and my limited coding skills. I should probably just get over it - particularly since the code itself probably says more than the notes. But - git is flexible enough that I imagine that this is an option: has anybody done this?
If you don't want to share the commit messages you can change the easily with `git commit --amend` (see this <https://help.github.com/articles/changing-a-commit-message/>). If you are afraid of things you have committed you can use `git rebase -i HEAD~10` which will allow you to squash the last 10 commits and allow you to rewrite the commit message. I would clone a new repo to test how it's going to work. You don't want an detached head :-). Have you seen this: <https://github.com/mixu/gr> it's basically what you are doing written in Node.js.

On 11 August 2015 at 12:23, Giles Orr <gilesorr@gmail.com> wrote:
I'm writing a Python script that checks git repositories in the user's home folder (other folders is an option that should be added soon) and then tells you their status, both local and remote. I want to release it publicly using github, but I'd like to maintain a private repo, and only push certain releases to github. I admit this is mostly because I keep extensive notes in the source code and am perhaps a bit embarrassed what those notes say both about my memory and my limited coding skills. I should probably just get over it - particularly since the code itself probably says more than the notes. But - git is flexible enough that I imagine that this is an option: has anybody done this?
I don't think this is so much a Python matter as a question of how you deal with your work in your branches. (And maybe I'm wrong, but I'll run through the "squash" answer quickly!) The thing that I'll often do that is like this is to open local branches to fix bugs, and then, when preparing for release, to merge the results into the branch I want to push publicly, using the --squash option to get rid of any cruddy little commits that might seem embarrassing. http://stackoverflow.com/questions/5308816/how-to-use-git-merge-squash The first example seems pretty good... Suppose I did my work (with a bunch of dumb little commits) on the "bugfix" branch, and I want to put it into the "master" branch, voila... git checkout master git merge --squash bugfix git commit git push some-public-remote master This addresses the problem of "cleaning up messy commits." If the problem is that you want some of your python sources to get released, and others not, then you'd presumably need to have some sort of tool that rewrites the Python to remove (most? all?) comments. Writing a "let me bowlderize the python code" tool seems likely to get real messy... -- When confronted by a difficult problem, solve it by reducing it to the question, "How would the Lone Ranger handle this?"

On 11 August 2015 at 12:41, Christopher Browne <cbbrowne@gmail.com> wrote:
On 11 August 2015 at 12:23, Giles Orr <gilesorr@gmail.com> wrote:
I'm writing a Python script that checks git repositories in the user's home folder (other folders is an option that should be added soon) and then tells you their status, both local and remote. I want to release it publicly using github, but I'd like to maintain a private repo, and only push certain releases to github. I admit this is mostly because I keep extensive notes in the source code and am perhaps a bit embarrassed what those notes say both about my memory and my limited coding skills. I should probably just get over it - particularly since the code itself probably says more than the notes. But - git is flexible enough that I imagine that this is an option: has anybody done this?
I don't think this is so much a Python matter as a question of how you deal with your work in your branches. (And maybe I'm wrong, but I'll run through the "squash" answer quickly!)
The thing that I'll often do that is like this is to open local branches to fix bugs, and then, when preparing for release, to merge the results into the branch I want to push publicly, using the --squash option to get rid of any cruddy little commits that might seem embarrassing.
http://stackoverflow.com/questions/5308816/how-to-use-git-merge-squash
The first example seems pretty good...
Suppose I did my work (with a bunch of dumb little commits) on the "bugfix" branch, and I want to put it into the "master" branch, voila...
git checkout master git merge --squash bugfix git commit git push some-public-remote master
This addresses the problem of "cleaning up messy commits."
If the problem is that you want some of your python sources to get released, and others not, then you'd presumably need to have some sort of tool that rewrites the Python to remove (most? all?) comments. Writing a "let me bowlderize the python code" tool seems likely to get real messy...
A co-worker has suggested I create a new repo and simply copy the files I want to put on github into it. Since there will only be three or four files, this seems reasonable. Likewise, future commits could be copied over with less comments in the code and a public-friendly commit message. And (possibly most important), the private repo could have a branch with the github repo (and its pull requests) as a remote. This is so far seeming like the simplest solution. -- Giles http://www.gilesorr.com/ gilesorr@gmail.com

I admit this is mostly because I keep extensive notes in the source code and am perhaps a bit embarrassed what those notes say both about my memory and my limited coding skills. I should probably just get over it - particularly since the code itself probably says more than the notes.
My experience with open source is that it is undercommented, if indeed it has any comments at all. (Darktable, I'm looking at you.) It's enormously helpful to understand the writer's thinking process. People can skip over the comments or even do a selective erase if they don't like them. Then, if the reader understands your objective and finds your code clunky in achieving that objective, they can show their superior grasp by providing an alternative (often more concise and difficult to understand) solution. I'm reminded of stories of Gauss, the famous mathematician and scientist of whom it was said 'he removed all the scaffolding from his constructions, so it appeared he arrived at the result by magic'. There's too much of that kind of thinking in software. Peter -- Peter Hiscocks Syscomp Electronic Design Limited, Toronto http://www.syscompdesign.com USB Oscilloscope and Waveform Generator 647-839-0325

On 11 August 2015 at 13:34, <phiscock@ee.ryerson.ca> wrote:
I admit this is mostly because I keep extensive notes in the source code and am perhaps a bit embarrassed what those notes say both about my memory and my limited coding skills. I should probably just get over it - particularly since the code itself probably says more than the notes.
My experience with open source is that it is undercommented, if indeed it has any comments at all. (Darktable, I'm looking at you.) It's enormously helpful to understand the writer's thinking process. People can skip over the comments or even do a selective erase if they don't like them.
Then, if the reader understands your objective and finds your code clunky in achieving that objective, they can show their superior grasp by providing an alternative (often more concise and difficult to understand) solution.
I'm reminded of stories of Gauss, the famous mathematician and scientist of whom it was said 'he removed all the scaffolding from his constructions, so it appeared he arrived at the result by magic'. There's too much of that kind of thinking in software.
Thanks to everyone for the thoughts, it was a help. And here we have it for anyone who's interested: https://github.com/gilesorr/gitcheck -- Giles http://www.gilesorr.com/ gilesorr@gmail.com
participants (4)
-
Christopher Browne
-
Giles Orr
-
Myles Braithwaite
-
phiscock@ee.ryerson.ca