From: Jason Sewall <jasonsewall@gmail.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: "George Dennie" <gdennie@pospeople.com>, "Jan Krüger" <jk@jk.gs>,
git@vger.kernel.org
Subject: Re: Hey - A Conceptual Simplication....
Date: Wed, 18 Nov 2009 14:52:06 -0500 [thread overview]
Message-ID: <31e9dd080911181152h665d5d9dr5c0736c0ca3234c1@mail.gmail.com> (raw)
In-Reply-To: <m37htnd3kb.fsf@localhost.localdomain>
Sorry for the 2x post, George; forgot to include the list in my reply....
On Wed, Nov 18, 2009 at 1:51 PM, George Dennie <gdennie@pospeople.com> wrote:
[some cleanup of quote line wrapping]
> Jason Sewall wrote...
>> If you have a bunch of debugging code sitting around in your
>> working tree after you've tracked down a problem, you don't want to
>> commit all of those printfs, etc. - you want to commit the
>> fix. This has ramifications from making diffs of history cleaner to
>> making git bisect actually useful.
> One of the concerns I have with the manual pick-n-commit is that you
> can forget a file or two. Consequently, unless you do a clean
> checkout and test of the commit, you don't know that your
> publishable version even compiles. It seems safer to commit the
> entirety of your work in its working state and then do a clean
> checkout from a dedicated publishable branch and manually merge the
> changes in that, test, and commit.
I find git status very useful in preparing a commit; untracked (and
'un-ignored') files are listed right there and I can if there are new
source files that are not present but not tracked. You could even add
a 'pre-commit hook' to make sure that you don't have any untracked *.c
(or whatever) files before you actually make the commit.
As to 'publishable' version, it's probably a good idea to run 'make
distcheck' or the equivalent before making a release anyway.
> It seems the intuitive model is to treat version control as applying
> to the whole document, not parts of it. In this respect the document
> is defined by the IDE, namely the entire solution, warts and
> all. When you start selectively saving parts of the document then
> you are doing two things, versioning and publishing; and at the same
> time. This was a critical flaw in older version control approaches
> because the software solution document is a file system sub-tree.
I find this leads to big, shapeless commits and, as I mentioned
before, it seriously limits the utility of 'git bisect'. I also fail
to see how 'selectively saving parts of the document' is versioning
and publishing - what is the publishing part? The act of committing
is one thing (and 'saving parts of the document' is one conceivable
name for it) and publishing another. Your workflow may vary, but
before actually 'publishing' (perhaps pushing out to a public repo, or
merging into a public branch), it's probably a good idea to test the
code with whatever system you use anyway.
> What you termed the debugging/printf's I would treat as a
> distinctions between a debug vs. a release version that may be
> suitably delineated by #define's or preferably separate unit tests
> assemblies. If I must prune prior to committing; however, then it
> seems reverting spurious printf's may offer a more reliable and
> automatable technique than ensuring that I have added all the new
> class files, resource files, text files, sub projects, etc; that may
> constitute the "fix." Once so selectively reverted I can test and
> commit such a publishable version.
What if you are hacking away and make changes to several parts of the
code at once? Making the commits as fine-grained as possible makes it
easier to cherry-pick, bisect, and understand the history.
As to debugging code, I admit I sometimes will use git gui or git add
-p to stage just what I want and then put whatever is 'left over' in a
branch that I might use again later if another bug comes up. Then I
can reset --hard my 'working' branch and the debugging code is gone.
> Jason Sewell wrote...
>> Isn't fastidiously maintaining a .gitignore file to contain
>> everything you *don't* want in the project more confusing than
>> explicitly specifying things you *do* want in the project?
>
> This is git ignore for "cleaning prior to a check" and git ignore
> for "adding to index" and is not an either or. You would specify
> what you don't want to version tracked as normal but you can also
> stipulate what you don't want to be deleted during a clean restore
> (which should otherwise completely wipe the folder prior to
> restoring a specific commit). This would permit embedding
> non-version elements within the version tree for whatever reason you
> find necessary.
Perhaps I don't understand your scheme, but it sounds like you're
advocating 2 .gitignores:
* .gitignore_track; with everything you don't automatically staged but
which can be trashed by your cleaning checkout
* .gitignore_keep; with things you don't want staged but which
shouldn't be deleted by git during cleaning
That seems even more confusing. I'm actually having trouble seeing
why you want this untracked-file nuking checkout at all. Care to give
an example?
> Thomas Rast wrote...
>> That would require supernaturally good maintenance of your
>> .gitignore to
> avoid adding or (worse) nuking files by accident.
>
> On the contrary, the approach would all but eliminate the
> possibility of loss of data since you would not manually (and
> therefore error prone-ingly) pruning until after a commit. In fact,
> one might default automatic commits (if required) prior to checkouts
> or at least an alert system when uncommitted changes exists.
Who is pruning after a commit? Once nice thing about checkout is that
it will refuse to move to a different commit if there are files that
will get trashed. Then you can say 'oops, I should stash/commit/nuke
that stuff before I change HEAD.
Jason
next prev parent reply other threads:[~2009-11-18 19:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 12:55 Hey - A Conceptual Simplication George Dennie
2009-11-18 13:18 ` Jonathan del Strother
2009-11-18 13:25 ` Jan Krüger
2009-11-18 18:51 ` George Dennie
2009-11-18 19:40 ` Jakub Narebski
2009-11-18 19:52 ` Jason Sewall [this message]
2009-11-19 2:03 ` George Dennie
2009-11-19 7:42 ` Björn Steinbrink
2009-11-19 20:12 ` George Dennie
2009-11-19 21:27 ` Junio C Hamano
2009-11-20 0:49 ` Jakub Narebski
2009-11-20 6:27 ` Junio C Hamano
2009-11-20 2:31 ` Dmitry Potapov
2009-11-19 10:27 ` Jakub Narebski
2009-11-20 1:48 ` Dmitry Potapov
2009-11-20 1:55 ` david
2009-11-20 2:56 ` Dmitry Potapov
2009-11-20 2:35 ` Björn Steinbrink
2009-11-20 3:08 ` Dmitry Potapov
2009-11-20 1:35 ` Dmitry Potapov
2009-11-20 6:33 ` Junio C Hamano
2009-11-20 15:07 ` Dmitry Potapov
2009-11-18 13:30 ` Thomas Rast
2009-11-18 13:31 ` Jason Sewall
2009-11-18 20:36 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31e9dd080911181152h665d5d9dr5c0736c0ca3234c1@mail.gmail.com \
--to=jasonsewall@gmail.com \
--cc=gdennie@pospeople.com \
--cc=git@vger.kernel.org \
--cc=jk@jk.gs \
--cc=jnareb@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).