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.

Subproject shows some internal changes with commit hash

See original GitHub issue

Description

screen_91 eeeeehh … wat!!! o____O

So I added a subproject in one of my projects and now I get this weird “change”. I cannot track it down to a specific file. The option in the context menu opens up the projects local folder but does not select the file although I made it show hidden files. I see there are files with the shown hash inside the .git folder but I could not find any files with the shown Subproject commit string. So is this some internal thing already? What happens if I discard it? Or submit it even!?!?

Version

  • GitHub Desktop: Github Desktop 1.1.1
  • Operating system: Microsoft Windows [Version 10.0.16299.371]

Steps to Reproduce

Expected Behavior

  • things are not confusing

Yeah sure … other things that could make it so:

  • the thing is just hidden
  • it says what it is.
  • There is a link to its documentation
  • there are only helpful context menu options available
  • something that says: This is alright! Everything is fine.

Actual Behavior

There is this item. I didn’t create it. I dunno what it does. I have no clue if its good or bad. I’m afraid to submit or discard it although I have the options to do so. It cannot be found in any file. I have no idea if I need to do something about it at all.

Additional Information

I was trying to look up subproject in open or closed issues. Didn’t find a thing. But somehow I managed to dig up this. Ah a pull request. So there was something about it? But … well I still cannot find any explanations.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
iAmWillShepherdcommented, Apr 25, 2018

If you add a submodule the main repo remembers the original commit that was used at the time of adding?

Yes, Git treats submodule changes the same way as it treats changes to any other file.

Each time the submodule changes I would need to update the main repo with the change item described?

👍

And when I discard the change in the main repo: Does it actually revert the changes in the submodule right away?!?!

👍

1reaction
iAmWillShepherdcommented, Apr 23, 2018

Thanks for taking the time to open an issue! 🙇

Desktop’s support for submodules is limited at the moment, but I can help nonetheless.

Looks like the change you are seeing is due to a submodule being updated to point to another commit. Have you updated that specific submodule recently or made any commits? If so, you will either need to update the main repo to use the updated submodule or discard the changes and continue using the previous version of the submodule.

Here are steps to reproduce this behavior in the CLI.

Setting up a suitable environment $ mkdir git-submodules && cd git-submodules && git init -q $ git submodule add https://github.com/carloscuesta/gitmoji.git

$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

	new file:   .gitmodules
	new file:   gitmoji

$ git add . $ git commit -m "add a submodule

$ ls
total 8
drwxr-xr-x   5 williamshepherd  staff   160B Apr 23 11:51 .
drwx------+  4 williamshepherd  staff   128B Apr 23 11:48 ..
drwxr-xr-x  13 williamshepherd  staff   416B Apr 23 11:59 .git
-rw-r--r--   1 williamshepherd  staff    89B Apr 23 11:51 .gitmodules
drwxr-xr-x  13 williamshepherd  staff   416B Apr 23 11:51 gitmoji

Exploring your issue What happens if I make a change to the newly added submodule?

  1. $ cd gitmoji
  2. $ echo "just a text file" > file.txt
  3. $ git add file.txt
  4. $ git commit -m "add a new file
  5. $ cd ..

At this point, from the root of the repository:

$ git diff gitmoji
diff --git a/gitmoji b/gitmoji
index 22d3bf0..00a3c2c 160000
--- a/gitmoji
+++ b/gitmoji
@@ -1 +1 @@
-Subproject commit 22d3bf07452ad5d6865b2e5820e4b4ec20054958
+Subproject commit 00a3c2c727c111bfc5dd48e685b0cd6a15f68ca1

Now that I’ve updated the submodule, I have two options:

  • Use the updated submodule in the main repo - add and commit
  • Continue using the original submodule before changes were made - discard the changes made to the submodule
Read more comments on GitHub >

github_iconTop Results From Across the Web

git submodules - Git diff says subproject is dirty - Stack Overflow
A workaround for this is to do a "Stash changes" (TortoiseGit meny item) in the affected submodule. This should remove your untracked files...
Read more >
How do git submodules work? - Matthew Brett on github
In this case, all super sees is that the commit has changed. $ git add subproject. As when we first added the submodule,...
Read more >
Submodule commit file is no longer showing the commit hash ...
I use a GIT repo. When viewing the repo inside VSTS, the submodule reference file used to show the commit hash, i.e. the...
Read more >
git-diff-tree Documentation - Git
This format shows an inline diff of the changes in the submodule contents between the commit range. Defaults to diff.submodule or the short...
Read more >
Git submodule shows new commits, submodule status says ...
Run git diff in the top-level repository to show what has actually changed Git thinks. If you've already made some commits in your...
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