git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Chase Venters <chase.venters@clientec.com>
Cc: git@vger.kernel.org
Subject: Re: Question about your git habits
Date: Fri, 22 Feb 2008 17:42:22 -0800	[thread overview]
Message-ID: <7vk5kw4fep.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200802221837.37680.chase.venters@clientec.com> (Chase Venters's message of "Fri, 22 Feb 2008 18:37:14 -0600")

Chase Venters <chase.venters@clientec.com> writes:

[jc: kernel-list removed from CC: as this does not have anything
to do with them]

> My question is: If you're working on multiple things at once,
> do you tend to clone the entire repository repeatedly into a
> series of separate working directories and do your work there,
> then pull that work (possibly comprising a series of
> "temporary" commits) back into a separate local master
> respository with --squash, either into "master" or into a
> branch containing the new feature?
>
> Or perhaps you create a temporary topical branch for each
> thing you are working on, and commit arbitrary changes then
> checkout another branch when you need to change gears, finally
> --squashing the intermediate commits when a particular piece
> of work is done?

It is a matter of taste, but in any case, you should not have to
squash that often.  If you find you are always squashing because
you work on one thing and then switch to another thing before
you are done with the former, something is wrong.

	Clarification: I am not saying squashing is wrong.  I am
	just saying you should not have to.

If you want to park what you were working on before switching to
do something else, you can (and probably should) commit and it
is a very valid thing to do (an alternative is "git stash").

When resuming, if that parked commit was half-baked and
something you do not want to go back to later, then the next
commit (be it another commit that merely "parks" before getting
distracted to do something else, or a commit that finally gets
everything "finito") can be made with "commit --amend".  That
way, your sequences of commits will consist of only logically
separate units, without half-baked ones you had to create only
because you switched branches.

Some people prefer to use multiple simultanous work trees.  You
certainly can use "clone" to achieve this.  And local clone is
very cheap as it shares the object database from the origin by
default.

Many people prefer to use topic branches, and working in a
single repository with multiple branches and switching branches
without ever cd'ing around is certainly a possible and very
valid way to work.  As long as your build infrastructure is sane
(e.g. your project does not have a central header file that any
little subsystem change needs to modify and included by
everybody, which tends to screw up make quite badly), switching
branches would not incur too much recompilation either and it
obviously will save disk space not having to leave multiple
checkout around.

You can also work with a single repository, multiple branches
and have multiple simultaneous work trees attached to that
single repository, by using contrib/workdir/git-new-workdir
script.

  parent reply	other threads:[~2008-02-23  1:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-23  0:37 Question about your git habits Chase Venters
2008-02-23  1:26 ` Tommy Thorn
2008-02-23  1:28 ` Steven Walter
2008-02-23  1:37 ` Jan Engelhardt
2008-02-23  1:44   ` Al Viro
2008-02-23  1:51     ` Junio C Hamano
2008-02-23  2:09       ` Al Viro
     [not found]         ` <998d0e4a0802221823h3ba53097gf64fcc2ea826302b@mail.gmail.com>
2008-02-23  2:47           ` J.C. Pizarro
2008-02-23 11:39             ` Charles Bailey
2008-02-23 13:08               ` J.C. Pizarro
2008-02-23 13:17                 ` Charles Bailey
2008-02-23 13:36                   ` J.C. Pizarro
2008-02-23 14:01                     ` Charles Bailey
2008-02-23 17:10                       ` J.C. Pizarro
2008-02-23 18:16                         ` Charles Bailey
2008-02-23 18:47                           ` J.C. Pizarro
2008-02-23 19:28                             ` Charles Bailey
2008-02-23 18:19                         ` J.C. Pizarro
2008-02-23 14:08             ` Mike Hommey
2008-02-23  1:42 ` Junio C Hamano [this message]
2008-02-23 10:39   ` Samuel Tardieu
     [not found] ` <998d0e4a0802221736q4e4c3a28l101522912f7d3caf@mail.gmail.com>
2008-02-23  2:46   ` J.C. Pizarro
2008-02-23  4:10 ` Daniel Barkalow
2008-02-23  5:03   ` Jeff Garzik
2008-02-23  9:18   ` Mike Hommey
2008-02-23  4:39 ` Rene Herman
2008-02-23  8:56 ` Willy Tarreau
2008-02-23  9:10 ` Sam Ravnborg
2008-02-23 13:07 ` Jakub Narebski

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=7vk5kw4fep.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=chase.venters@clientec.com \
    --cc=git@vger.kernel.org \
    /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).