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?
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.
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.
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.
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 ).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With