question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discarding Changes to a File also Discards Unrelated Reverts Submodule Commits

See original GitHub issue

Describe 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

  1. Open repository (Foo) which includes a submodule (Bar). Bar is currently at, say c01dbed5.
  2. 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.
  3. Edit some other file in Foo - lets say README.md. Foo now shows README.md as also being changed - again expected behaviour
  4. Discard changes to only README.md in Foo.
  5. 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:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Afrontecommented, Sep 24, 2020

Duplicate of ####

[_****_](

  • url

)

1reaction
kanji-keraliyacommented, Sep 3, 2020

Same here . You can check this video https://www.kapwing.com/videos/5f4f320b6b4f1100288302ce

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found