[GTALUG] Slightly OT: git question

Giles Orr gilesorr at gmail.com
Tue Aug 11 17:00:50 UTC 2015


On 11 August 2015 at 12:41, Christopher Browne <cbbrowne at gmail.com> wrote:
> On 11 August 2015 at 12:23, Giles Orr <gilesorr at 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 at gmail.com


More information about the talk mailing list