Reputation: 8543
I usually want to create non fast-forward commits.
I know I can do that using the --no-ff
flag, but I tend to forgot that :(
Is there a way to set this as default?
Currently I'm using Git GUI (on Windows), is there any hook that could be used?
Upvotes: 0
Views: 88
Reputation: 47062
I usually want the same, so I set merge.ff
to false
in my ~/.gitconfig
:
git config --global merge.ff false
Unfortunately, that means all merges will be non-fast-forward... even those coming from your origin. So I use another alias to help fast-forward the updates I do want:
[alias]
ff = "!sh -c 'git merge --ff --ff-only ${1:-\"@{u}\"}' -"
This way I can do my fetch, and then git ff
to fast-forward the master branch. I've also been making use of a script to help keep my local branches up-to-date, called git-ffwd
.
So the work of updating, I've allowed fast-forward updates (and want them), but in the default merge case it will always generate a merge commit. I've found this to be a useful way to work.
This is the workflow from my command line... unfortunately, I'm not sure if GUIs cooperate well with arbitrary Git commands. :-( But I've found the command line more useful in getting the workflow that I want.
Upvotes: 1