git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: Eugene Sajine <euguess@gmail.com>
Cc: Markus Elfring <Markus.Elfring@web.de>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: Better cooperation between checkouts and stashing
Date: Tue, 2 Feb 2010 02:36:47 +0100	[thread overview]
Message-ID: <20100202013647.GM9553@machine.or.cz> (raw)
In-Reply-To: <76c5b8581002011444t4f955fcdrd1f582f5c043f705@mail.gmail.com>

On Mon, Feb 01, 2010 at 05:44:25PM -0500, Eugene Sajine wrote:
> >
> > I imagine that this case is useful because of usual work interruptions
> >
> > in software development. A developer tries to bring various tasks
> >
> > forward in parallel. Branches will be switched often with unfinished
> >
> > work that needs to be kept before the reactivation of another task.
> >
> 
> Aren't this and similar statements based on a general problem of
> people being afraid to commit, because CVS/SVN taught them to be
> affraid? We are in progress of migrating from CVS to GIT and this is
> one of the things i'm desperately fighting with.
> In Git Commit doesn't equal Share (it does in CVS), so why not to
> commit and save your work in progress and switch branches painlessly?

There are various pressures pushing against each other and the balance
will be different for each individual and each project. One aspect is
that committing often is encouraged. However, greatly contradicting
force is the pressure to have "clean history" - that is, self-contained,
clearly separated cnd bisectable ommits which introduce independent
changes and are pretty to look at, frequently quite different to
chronological log of the performed work.

Of course you can ignore that and just commit away, or build up large
changes "in advance", then split them up at once. The resulting number
of commits will be about the same, but their quality _and_ the spent
effort will be quite different. Optimum lies in appropriate balance of
the processes, as usual.

There are several ways to achieve the latter process, moreover. One
possibility is to do all changes in the working tree, then carefulling
factoring out various aspects to separate commits using index
manipulation and heavy `git add -p` usage; you would then certainly need
`git stash` in case you wanted to switch the branch. The other way is
to commit regularly creating a history structure similar to the
"careless committer", _however_ before pushing out and publishing the
commits, the history gets cleaned up and rewritten by `git rebase -i`.

Choosing the appropriate method involves all kinds of subtle tradeoffs
and I wonder whether there is a single good answer, it is a matter of
taste. I do the former, but maybe that's because I just dislike rebase
for different reasons. ;-) One natural way would be to hack in the
working tree, splitting up your work to 1-3 commits in the index, then
reviewing your complete local changeset and tweaking it by rebase -i
before finally publishing your self-contained masterpiece.

For better or worse, There Is More Than One Way To Do It in Git. ;-)

-- 
				Petr "Pasky" Baudis
If you can't see the value in jet powered ants you should turn in
your nerd card. -- Dunbal (464142)

  reply	other threads:[~2010-02-02  1:36 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 18:50 Better cooperation between checkouts and stashing Markus Elfring
2010-02-01 20:40 ` Junio C Hamano
2010-02-01 21:57   ` Markus Elfring
2010-02-01 22:44     ` Eugene Sajine
2010-02-02  1:36       ` Petr Baudis [this message]
2010-02-02 10:26         ` Markus Elfring
2010-02-02 11:04           ` Petr Baudis
2010-02-09 19:20   ` Markus Elfring
2010-02-09 20:06     ` Junio C Hamano
2010-02-09 21:01       ` Markus Elfring
2010-02-18 17:43       ` Markus Elfring
2010-02-18 20:09         ` Junio C Hamano
2010-02-27 21:33   ` Markus Elfring
2010-02-27 21:51     ` Junio C Hamano
2010-02-28 13:55       ` Markus Elfring
2010-02-28 22:57         ` Michael Witten
2010-03-01 10:50       ` Markus Elfring
2010-03-01 17:02         ` Michael Witten
2010-03-01 17:23           ` Junio C Hamano
2010-03-01 18:14             ` Michael Witten
2010-03-01 18:29               ` Markus Elfring
2010-03-01 19:44               ` Junio C Hamano
2010-03-01 21:20                 ` Markus Elfring
2010-03-02  1:41                   ` Michael Witten
2010-03-02  9:35                     ` Markus Elfring
2010-03-02 17:50                       ` Junio C Hamano
2010-03-03 15:55                         ` Markus Elfring
2010-03-04  7:46                           ` Michael Witten
2010-03-04 19:55                             ` Markus Elfring
2010-03-02  9:45               ` Markus Elfring
2010-03-02 18:05                 ` Junio C Hamano
2010-03-03 16:00                   ` Markus Elfring
2010-03-17 16:35           ` [PATCH] Clarification for the command "git checkout <branch>" Markus Elfring
2010-03-17 16:44             ` Avery Pennarun
2010-03-17 17:00               ` Markus Elfring
2010-03-17 17:58               ` Junio C Hamano
2010-03-17 18:21                 ` Markus Elfring
2010-03-17 18:37                   ` Junio C Hamano
2010-03-17 18:50                     ` Michael Witten
2010-03-17 19:23                       ` Junio C Hamano
2010-03-18 10:11                 ` Markus Elfring
2010-03-18 16:36                   ` Avery Pennarun
2010-03-18 17:19                     ` Michael Witten
2010-03-18 17:33                       ` Avery Pennarun
2010-03-19  8:28                         ` Markus Elfring
2010-03-19 17:17                           ` Avery Pennarun
2010-03-20  6:00                             ` Markus Elfring
2010-03-19  8:15                       ` Markus Elfring
2010-03-30 15:57                         ` Markus Elfring
2010-03-30 22:13                           ` Junio C Hamano
2010-03-31  3:58                             ` Ramkumar Ramachandra
2010-04-01  4:52                               ` Junio C Hamano
2010-04-01 13:09                                 ` Ramkumar Ramachandra
2010-04-01  6:38                             ` Markus Elfring
2010-04-10 13:30                             ` Markus Elfring
2010-04-10 22:31                               ` Junio C Hamano

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=20100202013647.GM9553@machine.or.cz \
    --to=pasky@suse.cz \
    --cc=Markus.Elfring@web.de \
    --cc=euguess@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).