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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:46:37+00:00 2026-05-29T19:46:37+00:00

I work on a team on a large repo. Recently we decided to move

  • 0

I work on a team on a large repo. Recently we decided to move one of the folders into its own submodule

-- aaa
     -- .git
     --  bbb
     --  ccc
     --  www      # this folder is going into its own repo.

I followed the instructions to filter out the www folder into its own repo listed here: Detach (move) subdirectory into separate Git repository. I moved the www folder out of the aaa repo.

I removed the directory from the master branch by running these commands:

 $ cd aaa
 $ git checkout master
 $ git rm -rf www
 $ git commit -m "remove the www/ folder from the aaa repo."

So now on master, the tree looks like this:

 -- aaa
     -- .git
     --  bbb
     --  ccc

I’d like to add www as a submodule by running:

$ cd aaa
$ git checkout master
$ git submodule add git@bitbucket.org:kevinburke/www.git www
Cloning into 'www'...
remote: Counting objects: 717, done.
remote: Compressing objects: 100% (392/392), done.
remote: Total 717 (delta 318), reused 711 (delta 317)
Receiving objects: 100% (717/717), 440.52 KiB | 58 KiB/s, done.
Resolving deltas: 100% (318/318), done.

That works fine on master. However, any time I try to switch to another branch, I get the following error:

$ cd aaa
$ git checkout other-old-branch
error: The following untracked working tree files would be overwritten by checkout:
    www/1...
    www/2...
    www/3...
    www/4...
Aborting

How can I remove the www folder from all the branches in the aaa repo? There are about 100 branches, so doing this manually would be a hassle.

I’m not worried about keeping any outstanding changes that exist in www folders of older branches.

  • 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-29T19:46:39+00:00Added an answer on May 29, 2026 at 7:46 pm

    Just use git checkout -f to swap branches, then remove them like you normally would and merge in master to get your submodule introduction.

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

Sidebar

Related Questions

I work in a medium sized team and I run into these painfully large
I work on a small Agile development team which is part of a large,
I work with a team that has a sharepoint site currently runnning and its
I work in a large team, and not everybody has upgraded from VS 2008
The team I work for manages a large collection of technical documentation which is
I'm with a fairly large team and we are running into problem with the
My team has recently converted a fairly large project to ARC. The conversion went
The team I work for manages a large collection of technical documentation which is
I work on a large, cross-team code base and quite often will notice code
I work in a distributed team and use a central git repository to collaborate

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.