Last active
November 7, 2025 03:14
-
-
Save claraj/e5563befe6c2fb108ad0efb6de47f265 to your computer and use it in GitHub Desktop.
Revisions
-
claraj revised this gist
Nov 7, 2025 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -64,9 +64,9 @@ If you add and commit files from the `project` directory, you'll see an entry fo If you want the project directory to have one git repo with everything in, follow these steps. In the `resources` directory (the inner directory with a git repo in): __rename the .git folder to .not_git_folder__ Or anything else. You will need to enable hidden files to see this in Windows file Explorer / Mac Finder. Use a command prompt or git bash (Windows) or terminal (Mac, Linux) and navigate to the `project` directory. You need to be in the directory above the one with the submodule - so in this example, the `project` directory (the outer directory, the one that should contain all the files). Then run the command `git rm --cached resources` -
claraj revised this gist
Oct 16, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,7 +45,7 @@ If you create a git repository in the project directory, and there's a git repos Sometimes this is what you want to do, but if what you want to do is to collect files from more than one directory together in to one repository, you only want one git repository for the entire project. So a submodule is not what you want to happen. When a git repo is created, it created a **hidden** directory called `.git` and that's how the git tool knows it's working with a git repository. All of the info about your past versions of code, the location of the GitHub remote etc.. are stored in files in this .git directory. If you have a git repo in the `project` directory, and another one in the `resources` directory, your file system will actually look like this, -
claraj revised this gist
Nov 23, 2021 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -64,7 +64,7 @@ If you add and commit files from the `project` directory, you'll see an entry fo If you want the project directory to have one git repo with everything in, follow these steps. In the `resources` directory (the inner directory with a git repo in): __delete the .git folder.__ You will need to enable hidden files to see this in explorer / finder. Use a command prompt or git bash (windows) or terminal (mac, linux) and navigate to the `project` directory. You need to be in the directory above the one with the submodule - so in this example, the `project` directory (the outer directory, the one that should contain all the files). Then run the command @@ -74,4 +74,3 @@ but replace __resources__ with your own directory name. The `--cached` part is Now you should be able to use the `git add` command to add all of the files in the resources directory to the main project's repository, and commit those files. -
claraj revised this gist
Jul 1, 2021 . 1 changed file with 23 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,47 +28,49 @@ The outer git repository will ignore the inner git repository. The inner git repository is known as a submodule. Let's say you have these files and directories ``` project |- file1.html |- file2.css |- resources |- info1.json |- info2.json ``` If you create a git repository in the project directory, and there's a git repository in the resources directory, all the files inside the resources directory will be ignored by the git repository in the project directory. A git repo inside another git repo is called a submodule. In other words, a directory with a git repository in, is inside another directory, also with a git repository in. The submodule doesn't have to be in the immediate subdirectory, it can be one or two or more levels above. Sometimes this is what you want to do, but if what you want to do is to collect files from more than one directory together in to one repository, you only want one git repository for the entire project. So a submodule is not what you want to happen. When a git repo is created, it created a hidden directory called .git and that's how the git tool knows it's working with a git repository. All of the info about your past versions of code, the location of the GitHub remote etc.. are stored in files in this .git directory. If you have a git repo in the `project` directory, and another one in the `resources` directory, your file system will actually look like this, ``` project |- .git |- file1.html |- file2.css |- resources |- .git |- info1.json |- info2.json ``` If you add and commit files from the `project` directory, you'll see an entry for the `resources` directory under files you've added and committed, but the `info1.json` and `info2.json` files will not be added. If you want the project directory to have one git repo with everything in, follow these steps. In the `resource`s directory (the inner directory with a git repo in): __delete the .git folder.__ You may need to enable hidden files to see this in explorer / finder. Use a command prompt or git bash (windows) or terminal (mac, linux) and navigate to the `project` directory. You need to be in the directory above the one with the submodule - so in this example, the `project` directory (the outer directory, the one that should contain all the files). Then run the command `git rm --cached resources` but replace __resources__ with your own directory name. The `--cached` part is really important, if you miss it out it will irreversably delete your `resources` directory! Now you should be able to use the `git add` command to add all of the files in the resources directory to the main project's repository, and commit those files. -
claraj revised this gist
May 14, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,8 +68,8 @@ Use a command prompt or git bash (windows) or terminal (mac, linux) and navigate `git rm --cached resources` but replace __resources__ with your own directory name. The --cached part is really important, if you miss it out it will irreversably delete your directory! Now you should be able to use the `git add` command to add all of the files in the resources directory to the main project's repository, and commit those files. -
claraj revised this gist
Apr 19, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ ## Problem, and symptoms: You experience one or more of these symptoms - you have code in a directory but it's not being pushed to GitHub. You just see an empty directory icon - you see this message when you add code to your git repository from the command prompt -
claraj revised this gist
Apr 20, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -67,7 +67,7 @@ Use a command prompt or git bash (windows) or terminal (mac, linux) and navigate `git rm --cached resources` but replace __resources__ with your own directory name. Now you should be able to use git to add all of the files in the resources directory to the main project's repository, and commit those files. -
claraj revised this gist
Apr 14, 2020 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,8 +63,12 @@ If you want the project directory to have one git repo with everything in, follo In the resources directory (the inner directory with a git repo in): __delete the .git folder.__ You may need to enable hidden files to see this in explorer / finder. Use a command prompt or git bash (windows) or terminal (mac, linux) and navigate to the project directory. You need to be in the directory that contains the In the project directory (the outer directory, the one that should contain all the files) run the command `git rm --cached resources` but replace __resources__ with your own file name. Now you should be able to use git to add all of the files in the resources directory to the main project's repository, and commit those files. -
claraj revised this gist
Apr 3, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,7 +63,7 @@ If you want the project directory to have one git repo with everything in, follo In the resources directory (the inner directory with a git repo in): __delete the .git folder.__ You may need to enable hidden files to see this in explorer / finder. In the project directory (the outer directory, the one that should contain all the files) run __git rm --cached resources__ but replace __resources__ with your own file name. Now you should be able to add all of the files in the resources directory. -
claraj created this gist
Apr 3, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ ## Problem, and symptoms: - you have code in a directory but it's not being pushed to GitHub. You just see an empty directory icon - you see this message when you add code to your git repository from the command prompt ``` hint: You've added another git repository inside your current repository. hint: Clones of the outer repository will not contain the contents of hint: the embedded repository and will not know how to obtain it. hint: If you meant to add a submodule, use: hint: hint: git submodule add <url> nodule hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached nodule hint: hint: See "git help submodule" for more information. ``` ## What's happening? You have added a git repository inside another git repository The outer git repository will ignore the inner git repository. The inner git repository is known as a submodule. Let's say you have these files ``` project |-file1.html |-file2.css |-resources |-info1.json |-info2.json ``` If you create a git repository in the project directory, and also in the resources directory, all the files inside the resources directory will be ignored. A git repo inside another git repo is called a submodule. Sometimes this is what you want to do, but if what you want to do is to collect files from more than one directory together, and some happen to have git repositories in, it's not what you want to happen. When a git repo is created, it created a hidden directory called .git and that's how the git tool knows it's working with a git repository. All of the info about your past versions of code, the GitHub remote etc.. are stored in files in this .git directory. If you gave a git repo in project, and another one in resources, your file system will actually look like this, ``` project |-.git |-file1.html |-file2.css |-resources |-.git |-info1.json |-info2.json ``` If you add and commit files from the project directory, you'll see an entry for the resources directory under files you've added and committed, but the info1.json and info2.json files will not be added. If you want the project directory to have one git repo with everything in, follow these steps. In the resources directory (the inner directory with a git repo in): __delete the .git folder.__ You may need to enable hidden files to see this in explorer / finder. In the project directory (the outer directory, the one that should contain all the files) run __git rm --cached resources__ but replaced __resources__ with your own file name. Now you should be able to add all of the files in the resources directory.