From 2c3ae2936afd915950e7d56655d287468e0e6690 Mon Sep 17 00:00:00 2001 From: Chalarangelo Date: Tue, 22 Jun 2021 20:41:13 +0300 Subject: [PATCH] Add disable fast forward merge --- snippets/disable-fast-forward.md | 22 ++++++++++++++++++++++ snippets/set-default-push-branch.md | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 snippets/disable-fast-forward.md diff --git a/snippets/disable-fast-forward.md b/snippets/disable-fast-forward.md new file mode 100644 index 000000000..327e4e976 --- /dev/null +++ b/snippets/disable-fast-forward.md @@ -0,0 +1,22 @@ +--- +title: Disable fast forward merging by default +tags: configuration,repository,intermediate +firstSeen: 2021-07-03T05:00:00-04:00 +--- + +Disables the default fast forwarding on merge commits. + +- Use `git config --add merge.ff false` to disable fast-forward merging for all branches, even if it is possible. +- You can use the `--global` flag to configure this option globally. + +```shell +git config [--global] --add merge.ff false +``` + +```shell +git config --global --add merge.ff false + +git checkout master +git merge my-branch +# Will never fast forward even if it's possible +``` diff --git a/snippets/set-default-push-branch.md b/snippets/set-default-push-branch.md index e4fe3fb06..1f573395e 100644 --- a/snippets/set-default-push-branch.md +++ b/snippets/set-default-push-branch.md @@ -14,6 +14,8 @@ git config [--global] push.default current ``` ```shell +git config --global push.default current + git checkout -b my-branch git push -u # Pushes to origin/my-branch