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

  • Home
  • SEARCH
  • 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 9183047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:42:27+00:00 2026-06-17T18:42:27+00:00

Background Using Git 1.8.1.1 on Linux. The repository looks as follows: master book The

  • 0

Background

Using Git 1.8.1.1 on Linux. The repository looks as follows:

master
  book

The submodule was created as follows:

$ cd /path/to/master
$ git submodule add https://user@bitbucket.org/user/repo.git book

The book submodule is clean:

$ cd /path/to/master/book/
$ git status
# On branch master
nothing to commit, working directory clean

Problem

The master, on the other hand, shows there are “new commits” for the book submodule:

$ cd /path/to/master/
$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   book (new commits)
#
no changes added to commit (use "git add" and/or "git commit -a")

Git should ignore the submodule directory completely, so that the master is also clean:

$ cd /path/to/master/
$ git status
# On branch master
nothing to commit, working directory clean

Failed Attempt #1 – dirty

Inside the file master/.gitmodules is the following, as per this answer:

[submodule "book"]
        path = book
        url = https://user@bitbucket.org/user/repo.git
        ignore = dirty

Failed Attempt #2 – untracked

Changed master/.gitmodules to the following, as per this answer:

[submodule "book"]
        path = book
        url = https://user@bitbucket.org/user/repo.git
        ignore = untracked

Failed Attempt #3 – showUntrackedFiles

Edited master/.git/config to the following, as per this answer:

[status]
   showUntrackedFiles = no

Failed Attempt #4 – ignore

Added the book directory to the master ignore file:

$ cd /path/to/master/
$ echo book > .gitignore

Failed Attempt #5 – clone

Added the book directory to the master as follows:

$ cd /path/to/master/
$ rm -rf book
$ git clone https://user@bitbucket.org/user/repo.git book

Question

How can the book submodule be in its own repository directory under the master repository yet have git ignore the book submodule? That is, the following should not display:

#
#       modified:   book (new commits)
#

How to suppress that message when executing git status in the master repository?

An article about git submodule pitfalls suggests this an inappropriate submodule usage?

  • 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-17T18:42:29+00:00Added an answer on June 17, 2026 at 6:42 pm

    To include another repository, that needn’t be tracked in its super-repo, try this:

    $ cd /path/to/master/
    $ rm -rf book
    $ git clone https://user@bitbucket.org/user/repo.git book
    $ git add book
    $ echo "book" >> .gitignore
    

    Then commit.

    As stated in the linked git submodule pitfalls article:

    … the only linkage between the parent and the submodule is [the] recorded value of the submodule’s checked-out SHA which is stored in the parent’s commits.

    That means that a submodule is not saved by its checked-out branch or tag, but always by a specific commit; that commit (SHA) is saved into the super-repo (the one containing the submodule) like a normal text file (it’s marked as such a reference, of course).

    When you check out a different commit in the submodule or make a new commit in it, the super-repo will see that its checked out SHA has changed. That’s when you get the modified (new commits) line from git status.

    To eliminate that, you can either:

    • git submodule update, which will reset the submodule to the commit currently saved in the super-repo (for details see the git submodule manpage; or
    • git add book && git commit to save the new SHA into the super-repo.

    As mentioned in the comments, consider abandoning the book submodule: clone it inside the super-repo, if tracking of its state as part of the super-repo is not necessary.

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

Sidebar

Related Questions

Some Background I have been using Git for a while now. The projects that
Currently writing a C# application it should do backups using GIT in the background.
Background: Using Canvas, Paint and Path objects I draw several geometries on the canvas,
Background: Using unix, codeigniter from localhost. I'd like to run a controllers via a
Background Using boost and other similar libraries is the easiest way to find compiler
Background: Using jQuery 1.7 client side PHP server side Using json responses with json_encode
Background Using JavaScript, I need to sort a large JSON object based on a
How to make android icons with transparent background using eclipse.I know that we can
I'm trying to set an image as the background using this code: root.setStyle(-fx-background-image: url('splash.jpg');
I'm trying to create a new spinner background using a 9 patch picture. I've

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.