On Mon, 2015-05-11 at 09:36 -0400, Darryl L. Pierce wrote:
> On Mon, May 11, 2015 at 09:23:27AM -0400, Darryl L. Pierce wrote:
> > A request for all, please avoid doing merge commits on your Git repo.
> > When these hit the shared repo it can cause Git to try and "fix" [1] the
> > commit when rebasing.
> > 
> > The way I do commits with Git is to rebase my work branch on master
> > before merging it into master. That way it's a true merge and not a
> > merge commit. To do this:
> > 
> > 1. Rebase your work branch:
> > 
> >  task-branch $ git rebase -i master
> > 
> > 2. Fix any merge issues on the work branch until you get a clean set of
> >    commits.
> > 3. Switch to master and then merge your branch:
> > 
> >   task-branch $ git checkout master
> >   master-branch $ git merge task-branch

Another tip, when merging to master use:

    master-branch $ git merge --ff-only task-branch

That will refuse to merge unless the merge is a "fast-forward", which is
the simple "copy my commits to the end of trunk" that we want. It is
just a safety check - if you do what Darryl says it has no effect, but
if you forgot to rebase properly git will complain instead of creating
an unintended merge commit.

> 
> http://mcpierce.blogspot.com/2012/08/git-fixup-and-autosquash.html
> 
autosquash! Lovely! Git is full of nice surprises.


Reply via email to