git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
BLBryan Lee <hi@looping.me>
Date
Jul 15, 2025, 05:31 UTC
Message-ID
<010001980c90be66-2401a0b0-5c86-4135-90e2-c325852ef168-000000@email.amazonses.com>
In-Reply-To
<BCD357B1-39B1-4B00-BEB2-EF2C20A0E4AF@gmail.com>
Lidong Yan <yldhome2d2@gmail.com> 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@gmail.com> wrote:
Show 23 quoted lines
>
> Bryan Lee <hi@looping.me> 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
Previous: Bryan LeeNext: Lidong Yan
Message 4 of 23 in “[BUG] git pull ignores pull.autostash=true configuration when used with --git-dir and --work-tree flags on a bare repository”
  1. Bryan LeeJul 15, 2025
  2. Lidong YanJul 15, 2025
  3. Bryan LeeJul 15, 2025
  4. Bryan LeeJul 15, 2025
  5. Lidong YanJul 15, 2025
  6. Junio C HamanoJul 15, 2025
  7. Lidong YanJul 16, 2025
  8. Johannes SixtJul 16, 2025
  9. Lidong YanJul 16, 2025
  10. Junio C HamanoJul 16, 2025
  11. pull: add pull.autoStash config optionLidong Yan, Jul 17, 2025
  12. Eric SunshineJul 17, 2025
  13. Lidong YanJul 17, 2025
  14. Junio C HamanoJul 17, 2025
  15. Lidong YanJul 17, 2025
  16. Junio C HamanoJul 17, 2025
  17. Junio C HamanoJul 17, 2025
  18. pull: add pull.autoStash config optionLidong Yan, Jul 18, 2025
  19. Junio C HamanoJul 18, 2025
  20. Lidong YanJul 19, 2025
  21. pull: add pull.autoStash config optionLidong Yan, Jul 20, 2025
  22. Junio C HamanoJul 21, 2025
  23. Ben KnobleJul 17, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.