What did you do before the bug happened? (Steps to reproduce your issue) I am using a bare Git repository to manage my dotfiles, following a common pattern where the Git directory is separate from the work tree. Here are the exact steps to reproduce the issue: 1. Create a bare repository and set up the alias: $ git init --bare $HOME/.dotfiles Initialized empty Git repository in /Users/bryan/.dotfiles/ $ alias dot='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' 2. Add a remote and create initial tracked file: $ dot remote add origin git@xxxxxxxxxx:username/dotfiles.git $ echo "# My dotfiles" > $HOME/README.md $ dot add $HOME/README.md $ dot commit -m "Initial commit" [main (root-commit) abc1234] Initial commit 1 file changed, 1 insertion(+) create mode 100644 README.md $ dot push -u origin main Branch 'main' set up to track remote branch 'main' from 'origin'. 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 4. Simulate a remote change (on another machine or via GitHub web interface): - Edit README.md on remote to add a line: "Updated from remote" - This creates a divergence between local and remote 5. Make local unstaged changes: $ echo "Local change" >> $HOME/.zshrc Verify there are unstaged changes: $ dot status On branch main Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: .zshrc no changes added to commit (use "git add" and/or "git commit -a") 6. Attempt to pull the remote changes: $ dot pull error: cannot pull with rebase: You have unstaged changes. error: Please commit or stash them. What did you expect to happen? (Expected behavior) Since I have configured pull.autostash=true globally, I expected Git to: 1. Automatically create a stash of my unstaged changes (the modified .zshrc file) 2. Pull the remote changes with rebase (as configured by pull.rebase=true) 3. Apply the stash after the pull completes successfully 4. Show output similar to: Created autostash: abc2345 First, rewinding head to replay your work on top of it... Fast-forwarded main to origin/main. Applied autostash. This is the behavior I get when using Git in a regular (non-bare) repository with the same configuration. What happened instead? (Actual behavior) Git immediately fails with an error message: error: cannot pull with rebase: You have unstaged changes. error: Please commit or stash them. The command exits with status code 1 and does not perform any stashing or pulling. What's different between what you expected and what actually happened? 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. To confirm this is specific to the --git-dir/--work-tree usage pattern, I tested the following workarounds: 1. Explicit --autostash flag works: $ dot pull --rebase --autostash Created autostash: def3456 Current branch main is up to date. Applied autostash. 2. The same configuration works in a regular repository: $ cd /tmp/test-repo $ git init $ git config pull.rebase true $ git config pull.autostash true $ echo "test" > file.txt $ git add file.txt $ git commit -m "test" $ echo "change" >> file.txt $ git pull origin main # This would autostash as expected Additional diagnostic information: 1. The configuration is properly loaded by Git: $ dot config --show-origin pull.autostash file:/Users/bryan/.config/git/config true $ dot config --show-origin pull.rebase file:/Users/bryan/.config/git/config true 2. Even setting the configuration directly in the bare repository doesn't help: $ dot config pull.autostash true $ dot config pull.rebase true $ cat $HOME/.dotfiles/config | grep -A2 "\[pull\]" [pull] rebase = true autostash = true $ dot pull error: cannot pull with rebase: You have unstaged changes. error: Please commit or stash them. 3. Using -c flag to override configuration inline also fails: $ git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME -c pull.autostash=true pull error: cannot pull with rebase: You have unstaged changes. error: Please commit or stash them. 4. GIT_TRACE output shows the pull command is executed but autostash is not attempted: $ GIT_TRACE=1 dot pull 2>&1 | head -5 11:09:57.474770 git.c:476 trace: built-in: git pull error: cannot pull with rebase: You have unstaged changes. error: Please commit or stash them. This appears to be a bug where the autostash functionality is bypassed when Git is invoked with --git-dir and --work-tree flags, possibly because the work tree context is not properly established when the autostash check occurs. [System Info] git version: git version 2.50.1 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon libcurl: 8.7.1 zlib: 1.2.12 SHA-1: SHA1_DC SHA-256: SHA256_BLK uname: Darwin 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:29 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6030 arm64 compiler info: clang: 17.0.0 (clang-1700.0.13.3) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh