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
> 
> Thanks.
> 
> 
> [1] On my task branches I use autofix to merge changes back to the
> appropriate previous commit in my branch. When I'm ready to merge them I
> use "git rebase -i HEAD~[some # of commits] --autofix". Git then takes
> all of the autofix commits and puts them after the appropriate commit to
> merge together.
> 
> If I a merge commit is accidentally included in there then git will try
> to rebase that merge commit and all hell can break loose.

Dug out this old post to my blog that has my steps for doing the commits
on a task-based branch:

http://mcpierce.blogspot.com/2012/08/git-fixup-and-autosquash.html

I've added a new comment on this post with the steps for doing an
autofix commit, but will write up a newer version of the post to include
this inline.

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/

Attachment: pgp_NkrC53d2E.pgp
Description: PGP signature

Reply via email to