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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:52:07+00:00 2026-05-24T23:52:07+00:00

I have a django project managed with git. I am git pushing it to

  • 0

I have a django project managed with git. I am git pushing it to my host. Now, I want to be able to push just one of the directories (inc. all sub dirs) to another git repo. How is it possible, if it is possible at all?

Edit: So I want that directory to be a git repo itself.

  • 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-24T23:52:08+00:00Added an answer on May 24, 2026 at 11:52 pm

    You could look at git’s support for submodules. You would add the second repository as a submodule to your main project, e.g. with commands like:

    git submodule add git://wherever/blah.git library-code
    git commit -m "Added a new submodule called 'library-code'"
    

    When you change into the library-code subdirectory, it’s as if the parent repository doesn’t exist – you can change origin to use a transport that you can push over and then push as if it were completely independent.

    To specify that you want the submodule to be at a particular version, you should change into the submodule and use git checkout to switch to the right version. Then you change back up to the main repository and stage and commit that new submodule version with:

    git add library-code
    git commit -m 'Change the submodule version'
    

    The tree of the main repository just stores the version that the submodule should be at, so when you push the main repository, it’s not pushing any of the files in the submodule.

    In order to split off this subdirectory, while preserving history, you’ll need to clone your original repository and user git filter-branch to rewrite the history, as described in this answer:

    • Detach (move) subdirectory into separate Git repository

    Then you can push that to a newly created repository GitHub repository, return to your original project, remove the subdirectory, and replace it with the submodule as described above.

    If you’re not very familiar with git concepts then this may be difficult for you – I would recommend reading up on git submodules beforehand.

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

Sidebar

Related Questions

So I have a django project I just created called 'coolprojectsite' the directory structure
After working on a Django project for a while, I now have to do
I have a Django project with one app called subscribe . In root urls.py
I have a django project which has two apps, one is AppA and AppB
I have a django project, but for some reason basic jquery isn't working. <html>
I have a Django project in which multiple processes are accessing the backend mysql
I have a django project that I have been working on as a solo
I have a django project which is laid out like this... myproject apps media
I have a Django project. Given a url, how can I know which view
I have a django project that runs on a Linux server, and I've been

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.