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 642111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:08:08+00:00 2026-05-13T21:08:08+00:00

It seems a git repo inside a parent repo isn’t included in a commit

  • 0

It seems a git repo inside a parent repo isn’t included in a commit on the parent unless it’s setup as a submodule. Is it possible to override this behaviour and treat the nested git repo as any other directory? I don’t want to rely on external dependencies through submodules but want to use git to manage these dependencies within the project.

  • 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-05-13T21:08:09+00:00Added an answer on May 13, 2026 at 9:08 pm

    1/ You could override that through:

    • either a git config setting: set the environment variable $GIT_DIR
      you define your .git directory of the nested Git working tree as an external .git (external to both the nested repo and the main repo)
    • or by setting your nested repo ‘N’ outside the main repo, but checkout that repo ‘N’ inside the main repo:
    core.worktree

    Set the path to the root of the work tree. This can be overridden by the GIT_WORK_TREE environment variable and the --work-tree command line option

    In both case, the idea is to have a nested worktree without any .git subdirectory in it.

    2/ With submodules, the nested git repo is not really included in the parent repo.
    A special entry is made in the parent tree to record the external Git SHA1.

    new file mode 160000
    index 0000000..4c4c5a2
    

    See also “nature of Git submodules” (third part of the answer)


    Nine years later, this discussion is quite clear:

    I don’t want to use submodules or crutches
    such as renaming all .git/ in subdirectories.
    I just want that Git treats my .git/ subdirs as plain dirs with any other names.

    Brian m. Carlson (bk2204) answers:

    This is not possible.
    You can’t add a non-bare repository as a part of a parent repository without using submodules.
    Git uses the .git directory to find the working tree and for safety reasons doesn’t allow files or directories named that to be checked in.
    Allowing users to check in .git directories would allow configuration and hooks to be stored as part of the repository, which would allow the execution of arbitrary code if someone cloned it and then changed into the
    subrepository.

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

Sidebar

Ask A Question

Stats

  • Questions 345k
  • Answers 345k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer An INSERT SELECT should be what you need. I'm not… May 14, 2026 at 5:47 am
  • Editorial Team
    Editorial Team added an answer I would normally make use of SVN externals for this.… May 14, 2026 at 5:47 am
  • Editorial Team
    Editorial Team added an answer There is no function that would allow you to do… May 14, 2026 at 5:47 am

Related Questions

Seems like a simple problem: I have an SVN repo inside our firewall. I
I have a number of branches in a git repository: david@Panama ~/app: git branch
My git repo contains sensitive passwords which, for reasons out of my control, can't
I've got a git-svn checkout of my entire repo (initialized in the standard git
I'm trying to import a cvs module into an existing git repo. I can

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.