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
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2025, 15:16 UTC
Message-ID
<xmqq5xfsdv3w.fsf@gitster.g>
In-Reply-To
<26cef1b9-1f17-447e-b647-3d32a3984997@kdbg.org>
Johannes Sixt <j6t@kdbg.org> 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.

Previous: Lidong YanNext: Lidong Yan
Message 10 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.