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

[BUG] git stash incorrectly showing submodule branch instead of superproject branch

From
SMStuart MacDonald <smacdonald@kaimaging.com>
Date
May 12, 2025, 15:19 UTC
Message-ID
<TO1PPF29324B4CE6D3518208073452C3C51CD97A@TO1PPF29324B4CE.CANPRD01.PROD.OUTLOOK.COM>
Bug report inline below. I am willing to provide further information but I am not subscribed to this list.

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

I am working on a UI that includes the hardware's SDK as a submodule. Both the UI and the SDK are our own code. A colleague is working on the SDK.

- clone out a project that has a submodule
- set up submodule properly
- create feature branch 'feature_foo'
- move submodule to colleague's feature branch 'feature_sdk_foo'
- develop for a while
- in superproject discover bug, fix bug
- create new superproject branch to contain bug fix 'bugfix_bar'
- leave submodule branch as is; I'm intending to return to it momentarily
- commit fix via 'git add --patch file1 file2 ...'
- save bugfix debugging via 'git stash push -m "debugging" file1 file2 ...'
What did you expect to happen? (Expected behavior)

'git stash list' shows stash@{0}: On bugfix_bar: debugging

What happened instead? (Actual behavior)

'git stash list' shows stash@{0}: On feature_sdk_foo: debugging

What's different between what you expected and what actually happened?

The "On <branch>" says the wrong branch; specifically it's the submodule's currently checked out branch. I have a number of branches on the go, and need to rely on stash telling me the branch I was on when pushing to determine when I no longer need the debugging. The said branch doesn't even exist in the superproject.

Anything else you want to add:

Using Git For Windows on Windows 10. Using the "git bash" command line git, not the UI git.

I'm pretty sure this used to work correctly, but it's been several years since my last repo with a submodule (circa 2021).

The Git For Windows bash PS1 prompt lists the current branch I'm on in the superproject, so the error is quite visible.

Reading the 'git stash' documentation didn't shed any light. Googling didn't reveal anyone encountering this problem. Searching git@vger.kernel.org didn't reveal anyone reporting this.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info]
git version:
git version 2.49.0.windows.1
cpu: x86_64
built from commit: cca1f38702730b35f52c29efd62864b85e85ddcc
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.12.1
OpenSSL: OpenSSL 3.2.4 11 Feb 2025
zlib: 1.3.1
uname: Windows 10.0 26100
compiler info: gnuc: 14.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe

[Enabled Hooks] CONFIDENTIALITY NOTICE: The contents of this email, including any attachments, may contain private and confidential information intended to be reviewed only by the individual(s) or organization to whom it is addressed and may be legally protected from disclosure. If you are not the intended recipient or an authorized representative of the intended recipient, please be notified that any review, distribution, copying, saving or disclosure is strictly prohibited. If you have received this email in error, please immediately notify the sender by return email and delete this email from your system, including from the deleted items folder. Thank you for your cooperation.

Next: K Jayatheerth
Message 1 of 17 in “[BUG] git stash incorrectly showing submodule branch instead of superproject branch”
  1. Stuart MacDonaldMay 12, 2025
  2. Re [BUG] git stash incorrectly showing submodule branch instead of superproject branchK Jayatheerth, May 12, 2025
  3. Stuart MacDonaldMay 12, 2025
  4. stash: fix incorrect branch name in stash messageK Jayatheerth, May 12, 2025
  5. JAYATHEERTH KMay 12, 2025
  6. Stuart MacDonaldMay 12, 2025
  7. Junio C HamanoMay 12, 2025
  8. Eric SunshineMay 12, 2025
  9. JAYATHEERTH KMay 13, 2025
  10. Junio C HamanoMay 14, 2025
  11. stash: fix incorrect branch name in stash messageK Jayatheerth, Jun 8, 2025
  12. René ScharfeJun 8, 2025
  13. stash: fix incorrect branch name in stash messageK Jayatheerth, Jun 8, 2025
  14. Junio C HamanoJun 8, 2025
  15. JAYATHEERTH KJun 11, 2025
  16. stash: fix incorrect branch name in stash messageK Jayatheerth, Jun 11, 2025
  17. Junio C HamanoJun 11, 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.