Git add remote subdirectory1/10/2024 ![]() Thanks if you could take a moment to help me explore how to fix firehawk % git submodule add įatal: not a git repository: firehawk % cat ansible/.gitįatal: pathspec 'ansible' did not match any firehawk % rm -r firehawk % git submodule add įatal: not a git repository: /Users/user/git/firehawk-deploy-dev/firehawk/ansible/././. so I tried to remove the created subfodler and try again, but it still didn't work. Creates a local repo by making a copy of a CodeCommit repository at the specified URL, in the specified subfolder of. Upon adding the submodule I got an error: " not a git repository". In my case I ran into trouble on the last step and I'm not sure how to fix my repo now. Thanks for sharing this possible approach. Git commit -m 'replaced plugins/media with a submodule'įor more on submodules, see this chapter in the Pro Git book: ![]() Git submodule add url_to_repo plugins/media Most probably you want to replace the directory with the new project as a submodule: git rm -r plugins/media The plugins/media directory still exists, untouched. Note that the original repository is unchanged: Or locally: git init -bare /tmp/proj-media.gitĪnd push the media branch to the remote with the name `master: git remote add proj-media /tmp/proj-media.git Next, create the target repository, for example on GitHub, You can confirm the result with git log media. A hidden file is created with the name of. After running the above command Git will first start cloning the remote repository. You can then commit and push updates to the. mkdir git submodule add Alternatively, we can first navigate to the destination folder and then run the above command without adding the subdirectory name.It may be useful to detatch or move a subdirectory in your repository, out to an external repository, especially if you want to re-use the contents of said subdirectories across multiple repositories. This will put all commits related to plugins/media in a new branch named media. Using the git subtree command to move a subdirectory in your repository into it's own Git repository. Let's say you have a project with a sub-directory called plugins/media and you want that in an independent repository: git subtree split -P plugins/media -b media With only the commits that involved the specified sub-directory. Git has a nice command to make this easy called subtree split. Would be better as an independent project. Note that we use the local file system as the remote, because we already have the files here, which makes everything faster. First, let git know the other repo exists and what to name it: cd /tmp/merge/autotrash git remote add ccbuild. Recently I realized that a sub-directory in a Git project Now let's merge ccbuild/src directory into the autotrash repository.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |