[GTALUG] Slightly OT: git question

Christopher Browne cbbrowne at gmail.com
Tue Aug 11 16:41:33 UTC 2015


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...
 --
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20150811/f8252efb/attachment.html>


More information about the talk mailing list