Subject: Re: question concerning branches

From: Johannes Sixt <[email-masked]>
Date: Thu, 20 Aug 2009 15:47:31 +0200

[Please don't cull the Cc list.]

Ingo Brueckl schrieb:
> On the one hand, I want to add single new features (such as other developers
> do) which will be written, tested and committed. I want to push/pull
> frequently to be up to date all the time. (master branch)

If you want to stay up-to-date while you are creating a new feature, then
your workflow is sub-optimal. This message by Linus is good to read:

http://www.mail-archive.com/[email-masked]/msg39091.html

The important rule is "Don't merge upstream code at random points".

Once you learnt this rule, then you also see that it is not important to
always stay up-to-date. It is important to complete (test, debug) your
feature on a stable base. During that time, you don't care about upstream;
you care about your feature.

> In a branch, I learned, I have to commit or stash before I return to master
> for push/pull to follow the project. If I forget, I'm screwed, because files
> have changed due to the rewrite (in that branch), I won't get a warning until
> my first commit (in that branch) and commits (in master) will conflict.

You are obviously of a CVS or SVN mindset, where making a commit is such
an important operation that you don't dare to make it until your work is
*completed*.

With a git mindset, it won't happen that you "forget" whether you have
anything uncommitted; you simply never have because committing half-baked
stuff is the rule, not the exception. That is, before you get a cup of
coffee, you commit; before you answer a phone call, you commit; before you
turn your attention away, you commit. (That may be exaggerated, perhaps it
even isn't, but you get the point.)

When you have completed your work, you go back to make your commit history
look nice, comprehensible, and bisectable.

And only then comes the heavy operation: You publish your work for
consumption by interested parties. This may be even only you yourself:
"Consumption" would be to merge the work into your release branch. This is
the right time to care about upstream again.

-- Hannes