On Mon, Mar 28, 2011, Jason Swails wrote:
>
> I found a nice little feature of git that I think is worth bringing up
> regarding branches and merging. One nice feature of git merges is the
> --squash option.
>
> The command "git merge my_branch" will merge all of your commits into your
> current branch in chronological order, adding a commit on top that simply
> says "merge my_branch into master", or something of the like.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is true iff you current branch is "master"; otherwise "git merge
my_branch" merges into whatever your current branch is.
> In some
> instances, it may be nice to take all of the changes that your merge *would*
> make and combine it into a single commit on top of the branch you're trying
> to merge into (exactly what --squash does).
>
> The first approach allows users to see your development history in the steps
> you took (or committed), but it's scattered throughout the commit
> chronology. The second approach shows others looking through the history
> exactly what files were changed to introduce your functionality in a single
> commit.
>
> git merge --squash my_branch
>
> stages all of your changes to your current branch, and a "git commit" will
> commit the changes, allowing you to give your own log message for the
> combined commit.
I agree that this is a neat command: do lots of work (and lots of commits)
on your personal branch, then use the --squash option when you merge back
into the master. Certainly would help in cherry-picking such a merge to yet
another branch (such as at15-with-patches). But use your common sense: it's
not always appropriate, since the master branch won't have any fine-grained
history.
>
> While it's not always appropriate, it may help to clean up the history some
> and make it a little bit more comprehensible. I imagine this is good stuff
> to put on the wiki, but I don't know how to edit it (any help on this
> front?).
You click on "edit page" at the top right-hand corner; password is 'pakrules'.
You get an editing window with help at the bottom: "basic editing", "text
formatting rules", etc.
...dac
_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Mon Mar 28 2011 - 13:00:02 PDT