0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

git config pull.ffに設定可能な値

Last updated at Posted at 2025-01-06

git config pull.ff onlyと設定したが戻したい方へ

デフォルトへ戻す

git config pull.ff true

trueのほかonyesもok

大文字・小文字区別なし
TrUeもok

0以外の整数もok(c言語)
-1000
0x123
00123
ほとほどにしましょう

  pull.ff
      By default, Git does not create an extra merge commit when merging
      a commit that is a descendant of the current commit. Instead, the
      tip of the current branch is fast-forwarded. When set to false,
      this variable tells Git to create an extra merge commit in such a
      case (equivalent to giving the --no-ff option from the command
      line). When set to only, only such fast-forward merges are allowed
      (equivalent to giving the --ff-only option from the command line).
      This setting overrides merge.ff when pulling.

falseにする

Fast-forwardを禁止し、常にマージコミットを作成。
false,off,no,0にする
用途あれば

onlyにする

もちろんgit config pull.ff only

こちらはonly限定

現在の設定値

git config pull.ff

参考ソースコード

/**
 * If pull.ff is unset, returns NULL. If pull.ff is "true", returns "--ff". If
 * pull.ff is "false", returns "--no-ff". If pull.ff is "only", returns
 * "--ff-only". Otherwise, if pull.ff is set to an invalid value, die with an
 * error.
 */
static const char *config_get_ff(void)
{
	const char *value;

	if (git_config_get_value("pull.ff", &value))
		return NULL;

	switch (git_parse_maybe_bool(value)) {
	case 0:
		return "--no-ff";
	case 1:
		return "--ff";
	}

	if (!strcmp(value, "only"))
		return "--ff-only";

	die(_("invalid value for '%s': '%s'"), "pull.ff", value);
}

最終的にgit_parse_maybe_bool_textに行き着きます

int git_parse_maybe_bool_text(const char *value)
{
	if (!value)
		return 1;
	if (!*value)
		return 0;
	if (!strcasecmp(value, "true")
	    || !strcasecmp(value, "yes")
	    || !strcasecmp(value, "on"))
		return 1;
	if (!strcasecmp(value, "false")
	    || !strcasecmp(value, "no")
	    || !strcasecmp(value, "off"))
		return 0;
	return -1;
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?