Discarding Changes to a File also Discards Unrelated Reverts Submodule Commits
See original GitHub issueDescribe the bug
When using submodules, if changes to a file completely unrelated to the submodule (e.g. Readme.md) are discarded, the submodule is randomly checked out to the last committed SHA (detached head state), even though the submodule should not have been touched.
Version & OS
- Windows 10 (2004)
- Github Desktop Version 2.5.4
Steps to reproduce the behavior
- Open repository (Foo) which includes a submodule (Bar). Bar is currently at, say
c01dbed5
. - Make commits to the submodule (Bar), its head is now at, say
deadbeef
. Foo repository now shows Bar as changed - showing -c01dbed5
+deadbeef
- this is expected behaviour. - Edit some other file in Foo - lets say README.md. Foo now shows README.md as also being changed - again expected behaviour
- Discard changes to only README.md in Foo.
- Bar is now back at
c01dbed5
- even though it was not discarded! Changes in the submodule go irrevocably missing.
Expected behavior
After discarding the unrelated file (README.md), the submodule should be untouched - it should have remained at deadbeef
and not reverted, it was not asked to be discarded.
Actual behavior
Changes to the submodule get discarded - it gets reverted from deadbeef
to c01dbed5
even though it was not asked to be discarded.
Additional context
This has started happening since the latest update (2.5.4) - it may therefore be related to changes for #8218.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Git How to discard changes to a submodule - Stack Overflow
A submodule is a Git repository. ... Go to the folder (for which you want to revert all changes) and execute git checkout...
Read more >Discarding changs in git and submodules - Kalyan
To discard local changes in git repository ... means there are some hidden/gitignored files lying around in submodule repository directory.
Read more >Manual
Conversely, the Unstage command (Local|Stage) will discard the selected file's changes in the Index, meaning that the Index changes will be lost, unless...
Read more >EGit/User Guide - Eclipsepedia
Enter a commit message explaining your change, the first line (followed by an empty line) will become the short log for this commit....
Read more >Download - Sublime Merge
Patches: Easily create and apply patches using the commit and file ... Submodules: Fixed submodule diffs showing outdated hashes; Files List: Fixed discard...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Duplicate of ####
url
)
Same here . You can check this video https://www.kapwing.com/videos/5f4f320b6b4f1100288302ce