Hi Dasa,

You could use "git pull --rebase" instead but this does not preserve merge commits

I just did a test on my git lab, I've got a bare repo and 2 clones.

Clone 1:
1- I checkout a new branch test1
2- I created a file test1.txt
2- I add/commit test1.txt
3- I checkout master
4- I merged --no-ff test1
5- I deleted test1
6- I push

Clone 2:
1- I created a file file1.txt
2- I add/commit file1.txt
3- I pull --rebase
4- I push

Clone 1:
1- I pull --rebase

the git log on both clones shows the merge commit, it has been preserved, so, I wonder what do you mean, did I miss something ?

Thanks,
-Fred

-----Message d'origine----- From: Dasa Paddock
Sent: Tuesday, March 19, 2013 8:12 PM
To: <dev@flex.apache.org>
Subject: Re: [3/3] git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop

Here's one way to avoid having "git pull" create a merge commit on your develop branch. Checkout your develop branch and then run:

$ git pull --ff-only

If this give you an error it means you have commits on your develop branch that are ahead of the remote develop branch. So then, run:

$ git rebase --preserve-merges origin/develop

This will rebase your commits on your local develop branch onto the remote develop branch. (Use -p for short.)

You could use "git pull --rebase" instead but this does not preserve merge commits, which is what I commonly have following the git flow workflow. For more info on this, see:
http://notes.envato.com/developers/rebasing-merge-commits-in-git/

--Dasa

On Mar 19, 2013, at 11:39 AM, Frédéric THOMAS <webdoubl...@hotmail.com> wrote:

This is the best explanation of when to merge vs. rebase that I've seen:
http://blog.sourcetreeapp.com/2012/08/21/merge-or-rebase/

Added as comment to the wiki

-Fred
-----Message d'origine----- From: Frédéric THOMAS
Sent: Tuesday, March 19, 2013 7:23 PM
To: dev@flex.apache.org
Subject: Re: [3/3] git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop

Hi,

This document is perfect, the maybe only little point it didn't cover in
"Keeping the feature branch up to date" is the possibility interactively
rebase your commit, which allows in case of too much conflicts, to abord it,
reset --hard and pull (fecth/merge).

Thanks for sharing,
-Fred

-----Message d'origine----- From: Dasa Paddock
Sent: Tuesday, March 19, 2013 6:57 PM
To: <dev@flex.apache.org>
Subject: Re: [3/3] git commit: Merge branch 'develop' of
https://git-wip-us.apache.org/repos/asf/flex-sdk into develop

This is the best explanation of when to merge vs. rebase that I've seen:
http://blog.sourcetreeapp.com/2012/08/21/merge-or-rebase/

There's also now a public beta of SourceTree for Windows available:
http://blog.sourcetreeapp.com/2013/03/19/introducing-sourcetree-for-windows-a-free-desktop-client-for-git/

In regards to these unwanted merges, I've seen GitHub for Windows do this
automatically instead of giving an error when you click it's Sync button and your local develop branch has commits that have not been pushed yet but the
remote also also has commits that are not yet on the local develop branch.

--Dasa



Reply via email to