explain "avoid merge commits" #12

groovecoder opened this Issue Oct 11, 2011 · 2 comments


None yet

3 participants


Git doc says "Most projects avoid merge commits unless they are necessary." but doesn't explain how to do so. GitHub's merge button always generates a merge commit (https://github.com/blog/843-the-merge-button) so it would be helpful to explain how to merge pull requests without a merge commit. I think the process is like http://help.github.com/send-pull-requests/ but instead of

$ git fetch <remote>
$ git merge <remote>/<branch>

is it

$ git fetch <remote>
$ git pull --rebase <remote>/<branch>


Obviously I'm not the one to write the doc on it.


Yeah, in the case of the merge-button, I favor the ease of just merging it at the pull request, but in a project where you ultimately merge your own patches:

git co master && git pull --rebase && git co mybranchfullofwork && git rebase master && git merge mybranchfullofwork

I have a command, given to me by @cvan, in my ~/.gitconfig that is:

get = "!f() { echo Merging $1 && git checkout master && git pull mozilla master && git submodule sync && git submodule update --init --recursive && git checkout $1 && git rebase master && git checkout master && git merge --ff-only $1; }; f"

Which let's me simply type git get branch-name, then push to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment