Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 and git merge --no-ff

Tags:

git

merge

xcode

I'm liking the git integration in Xcode 4 but when doing a merge it seems Xcode will only do the default merge with fast forward. I like to keep my feature branch lines separate. Does anyone know if it's possible to have Xcode's merge be no-fast-forward?

like image 439
Jamie Hamick Avatar asked Apr 06 '11 20:04

Jamie Hamick


People also ask

What is -- no FF in git merge?

The Git merge --no-ff command merges the specified branch into the command in the current branch and ensures performing a merge commit even when it is a fast-forward merge. It helps in record-keeping of all performed merge commands in the concerning git repo.

When should I use git no FF?

The --no-ff flag prevents git merge from executing a "fast-forward" if it detects that your current HEAD is an ancestor of the commit you're trying to merge. A fast-forward is when, instead of constructing a merge commit, git just moves your branch pointer to point at the incoming commit.

What is a non Fast forward merge?

A non-fast-forward merge is a merge where the main branch had intervening changes between the branch point and the merge back to the main branch. In this case, a user can simulate a fast-forward by rebasing rather than merging. Rebasing works by abandoning some commits and creating new ones.

What does git merge -- FF only do?

git merge --ff-only will abort if it cannot fast forward, and takes a commit (normally a branch) to merge in. It will only create a merge commit if it can't fast forward (i.e. will never do so with --ff-only ).


1 Answers

You can try and set the config

 branch.<name>.mergeoptions 

Sets default options for merging into branch .
The syntax and supported options are the same as those of git-merge, but option values containing whitespace characters are currently not supported.

So you can add the --no-ff there, and see if XCode4 respects the config for your feature branch.

As Yitschak adds in the comments:

git config branch.<name>.mergeoptions --no-ff 

Update 2019, with XCode 10: DaveDude repors:

With Xcode 10, this approach doesn't seem to work anymore.

Now, I set merge.ff=false and that gives me the desired behaviour again.

like image 60
VonC Avatar answered Sep 24 '22 13:09

VonC