[AMBER-Developers] git merging feature

From: Jason Swails <jason.swails.gmail.com>
Date: Mon, 28 Mar 2011 11:50:08 -0700

Hello everyone,

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. 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

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.

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?). Sorry to all those who already knew this...


Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
AMBER-Developers mailing list
Received on Mon Mar 28 2011 - 12:00:03 PDT
Custom Search