Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7857213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:58:03+00:00 2026-06-02T20:58:03+00:00

This seems a to be a common issue, but i just can’t find a

  • 0

This seems a to be a common issue, but i just can’t find a reasonable solution:
IMHO, the worse problem with git submodules is where submodule committed but not pushed changes are easily deleted with the containing repository usage of git submodule update. Quoting:

It’s not safe to run git submodule update if you’ve made and committed
changes within a submodule without checking out a branch first. They
will be silently overwritten:

(…followed by an example there).

So, to the question-
Let super be a repository root folder and submod be a child folder containing a submodule:

-super   
     -submod

When i commit in the submodule but not push, and then run git submodule update i get my committed changes in submod deleted (oh, the horror).
How can i add a confirmation are you sure question when i’m doing this?
hooks, scripts or any other applicable ideas are more the welcome.

TIA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:58:04+00:00Added an answer on June 2, 2026 at 8:58 pm

    There’s no hook for pre-submodule-update, so what you’d probably need to do is instead write a script that you use instead of git submodule update.

    A simple way to see if you have any modified submodules is this:

    if git submodule status | grep -q '^+'; then
        # at least one submodule has changes
    fi
    

    Also note that if an accidental update blows away your changes, you might still be able to salvage them via the submodule checkout’s reflog (since submodule checkouts are effectively full Git repositories in their own right).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be a common problem but I'm struggling to find a solution that
I know this a is a common issue, but everything I can find in
This seems like it would be a common issue to be but I don't
This seems to be a common problem, but I cant seem to fin a
This seems to be a common question, but I've yet to find a very
It seems this is a common question/problem but despite checking out a number of
This seems like it should be obvious but I can't figure it out. Suppose
Seems like a common issue but I don't know a straight forward answer for
This may be something common and trivial, but I seem to be having trouble
This seems to be a problem related to Safari only. I've tried 4 on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.