Boost logo

Boost :

Subject: Re: [boost] DCVS vs CVS: call for constructivism
From: greened_at_[hidden]
Date: 2012-03-23 00:11:12


Gottlob Frege <gottlobfrege_at_[hidden]> writes:

> To me, once done, these are separate commits/branches/features/changelists
> (whatever you want to call them). But while working on them, I don't want
> to flip between branches - I find I'm always changing something in the
> wrong branch when I try separate branches. ie I change code.cpp while in
> the "scripts" branch.

Done that. :)

I'm not sure if this is your intent but the above sounds like you have a
branch per file or file-type rather than a branch per topic. Put each
feature in a separate branch and don't care about which files a feature
might touch. Features are generally easy to identify and develop in a
self-contained manner. Sometimes there are dependencies and that's what
rebase and merge are for.

> So basically, in something like perforce, I can group the files into
> changelists, and then forget about it until something is completely done
> and ready to commit. I understand I'm losing other features (small commits,
> being able to easily set it all aside, etc), but this is my common
> workflow.

You can always do commits and then rearrange them later via rebase and
branch. There's no reason not to do small commits. Heck, you can even
chop a larger commit into smaller ones later if you want (rebase + add
-i).

> Should I do everything on a messy "work" branch and just sort it out when I
> am ready to push? Should I keep the features in separate branches, but pull
> from branch to branch all the time? (I don't think I want to spend that
> much time with the RCS. I like forgetting about it most of the time.)

I do the latter whenever possible. Branches are very cheap. I find
this workflow helps organize my thoughts. I'm not one who likes to
switch from feature-to-feature all the time. But even if I were I'd
still want to keep them physically separate as much as possible.

In the case where you commit something to the wrong branch, you can do
something like this:

http://stackoverflow.com/questions/1628563/git-move-recent-commit-to-a-new-branch

If you want to put it in an existing branch, checkout the newly created
branch, rebase it from the existing branch then checkout the existing
branch and merge the new branch in.

                            -Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk