git: subdirectory treated as a repo on its own

git subtree
git submodule
git submodule branch
git subtree vs submodule
git submodule update
git submodule foreach
git repo inside repo

I have cloned a template project. I have then tore it apart, to make it my own project. Now, git believe that a subdirectory is a branch of the original template project and even when I run git add . -A it does treat it as it was a repository.

When I was getting in the sub, the powershell was indicating that I was getting in a new repo. I executed rm -rf .git in the subdirectory.

Now however, git status says that the branch is up to date but in the master what I have is just an empty directory, while in origin I have all my code.

I tried this with no success.

Your subdirectory is a submodule, so you should use git submodule instructions, as below -

git clone <main app>
cd main_app
git submodule init
git submodule update 

How to tear apart a repository: the Git way, How do you divide a Git repo without squashing the history and breaking separate the libraries from the main repo, maintaining these in their own space. As a non-vanilla solution, we could have treated subdirectories as� After some research, I finally settled for Git subtree, one out of the many Git contributed software. In this post, I will show us some ways we could use to split out a folder into its own repository using Git subtree. Using my jquery-modal fork for demonstration, we’ll be splitting the examples folder into its own Git repository.

No trick did the job. I have just had to delete the repository and start from scratch. Ugly, but got the job done.

Submodules, A common issue arises in these scenarios: you want to be able to treat the The issue with copying the code into your own project is that any custom Submodules allow you to keep a Git repository as a subdirectory of another Git repository. A submodule allows you to keep another Git repository in a subdirectory of your repository. The other repository has its own history, which does not interfere with the history of the current repository. This can be used to have external dependencies such as third party libraries for example.

  1. Go to the subdirectory (let's say subDir) parent from where it is treated as it own repo.
  2. Now, You're in main git repo
  3. Change the name of that subdirectory (let's say subDir1).
  4. git pull origin <your branch> (it will pull changes from remote)
  5. Now you'll see that subDir and its name changed directory subDir1.
  6. Remove subDir1

Now, subDir and it's content will be part of your main repo.

Adding a folder from one repo to another, A few of the solutions I have seen requires deleting the _origin_ from _RepoFolderSrc_ . I should not make any changes to the _RepoFolderSrc_� The last thing I did was delete the polyester subdirectory from the original ballgown repository. And that’s all! Now what used to be in the polyester subdirectory of my ballgown repo now lives in its own GitHub repo, and it still has the whole commit history in it. Cool.

How can I create a git repo that contains several other git repos , A submodule allows you to keep another Git repository in a subdirectory of your repository. The other repository has its own history, which does not interfere with � Status quo. Let's assume we have a repository called repo-old which contains a subdirectory sub that we would like to convert into a submodule with its own repo repo-sub.. It is further intended that the original repo repo-old should be converted into a modified repo repo-new where all commits touching the previously existing subdirectory sub shall now point to the corresponding commits of our

Support for multiple .dvc roots in a single git repo � Issue #2349 , In this scenario, each project has its own subdirectory in the repo, Just adding the ability to treat separate subdirectories in a normal git repo� To rewrite the repository to look as if foodir/ had been its project root, and discard all other history: git filter-branch --subdirectory-filter foodir -- --all Thus you can, e.g., turn a library subdirectory into a repository of its own.

Splitting a subfolder out into a new repository, Clone the repository that contains the subfolder. $ git clone USERNAME/REPOSITORY-NAME. Change the current working directory to your � Why manage DEV posts in a Git repo? I like writing code in VS Code, with all its keyboard shortcuts, plugins, and other goodies I've added to make it my own. When I write Markdown in the DEV editor, I miss my local setup. That's the primary reason I set this up: I get to write articles in my own editor, with my own shortcuts and tools.

  • Maybe your directory is a submodule. Try git submodule to see if your directory appears there. If not, please be more specific and explain why you think that git treats the subdirectory as a repo.
  • looks like submodule check