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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lidong Yan <yldhome2d2@xxxxxxxxx> wrote:
> Maybe you can try `git config rebase.autostash true` instead.

Thank you! You're absolutely right. After testing, I can confirm that:

1. `pull.autostash` is not a real Git configuration option - it has no
effect whatsoever
2. The correct configuration is `rebase.autoStash=true` (for rebase operations)
3. This issue is not specific to bare repositories - it happens in
regular repos too

Here's my test in a regular (non-bare) repository that proves this:

```
$ git config --global pull.autostash true
$ git config --global pull.rebase true
$ echo "test" >> README.md  # create unstaged changes
$ git pull
error: cannot pull with rebase: You have unstaged changes.
error: Please commit or stash them.

$ git config --global rebase.autostash true
$ git pull
Updating 9571176..5125236
Created autostash: 9ad0490
Fast-forward
[... changes ...]
Applied autostash.
```

This raises an important issue: Git silently accepts invalid
configuration keys without any warning. Users can waste significant
time debugging "why isn't my configuration working?" when the
configuration key doesn't even exist.

Would it be worthwhile to:
1. Add a warning when users set non-existent configuration keys?
2. Or at least document common misconceptions like `pull.autostash` in
the git-config man page?

Thanks again for pointing me in the right direction!

On Tue, Jul 15, 2025 at 12:09 PM Lidong Yan <yldhome2d2@xxxxxxxxx> wrote:
>
> Bryan Lee <hi@xxxxxxxxxx> wrote:
> >
> > 3. Set global Git configuration for automatic rebasing and stashing:
> >   $ git config --global pull.rebase true
> >   $ git config --global pull.autostash true
> >
> >   Verify the configuration is set:
> >   $ git config --global pull.rebase
> >   true
> >   $ git config --global pull.autostash
> >   true
>
> Maybe you can try `git config rebase.autostash true` instead.
>
> > The difference is that Git is not honoring the pull.autostash=true
> > configuration when the repository is accessed using --git-dir and
> > --work-tree flags. The autostash feature is completely ignored, and
> > Git behaves as if pull.autostash=false.
>
> I’m not sure why this difference happens either.
>
> - Lidong





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux