Subject: Re: [BUG] git pull ignores pull.autostash=true configuration when used with --git-dir and --work-tree flags on a bare repository

From: Junio C Hamano <[email-masked]>
Date: Wed, 16 Jul 2025 08:16:19 -0700

Johannes Sixt <[email-masked]> writes:

> Instead of this complexity, it is most likely a lot easier to fix the
> origin of the misconception that `pull.autostash` is the correct
> configuration. After all, it isn't even mentioned in the git-config nor
> the git-pull man page.

git_pull_config() does pay attention to "rebase.autostash".  

Either it is a bug for the code to do so, or it is a bug that the
documentation does not talk about it.  

The reason why I think "git pull" that pays attention to
rebase.autostash is a bug is because the user is more likely to be
much more familiar with both branches involved and more likely to be
prepared to deal with conflicts potentially created by autostashing
behaviour when making a private merge or rebase of local branches,
than when pulling from other repositories.  So those who show
willingness to accept the responsibility of having to resolve
conflicts that arise when popping autostashed changes by setting
rebase.autostash may not want to be cavalier to the same degree when
running "git pull".  git_pull_config() that pays attention to
"rebase.autostash" breaks that expectation.

There is another curiosity.  git_pull_config() does not pay
attention to "merge.autostash", which seems inconsistent.

If I did not have any existing users, I would actually vote to teach
git_pull_config() stop paying attention to "rebase.autostash", but
we do not live in an ideal world.  Perhaps rectify this at Git 3.0?

We could give a convenience feature in the opposite direction as
well.

It is not inconceivable for the git_pull_config() function to
pretend as if rebase.autostash (when pull.rebase is true) or
merge.autostash (otherwise) is set to true when pull.autostash is
set to true.  It would have prevented this discussion thread from
happening.

I personally think that such an arrangement is backwards, though,
for the same reason why I think git_pull_config() should not pay
attention to "rebase.autostash".  So I am not sure if a new
"pull.autostash" variable is such a good idea to begin with.