Git

Git is a version control system.

Remove existing files from a Repository

  1. Add the file or pattern to your .gitignore
  2. Remove the file from the repo with git rm --cached

Source: https://stackoverflow.com/questions/4124792/remove-an-existing-file-from-a-git-repo

Remove a Submodule

git rm path-to-submodule
git commit -m "remove path-to-submodule"
# optionally
rm -rf .git/modules/path-to-submodule
git config --remove-section submodule.path-to-submodule

Source: https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule

Use .gitkeep files

# +----------------------------+
# |    Keep .gitkeep files      |
# +----------------------------+-------------------------------+
# | To keep an empty directory, add a .gitkeep file to it       |
# | and ignore the directory with a wildcard:                  |
# |                                                            |
# |     /path/to/dir/*                                         |
# |                                                            |
# | this will ignore the content but not the directory itself. |
# +------------------------------------------------------------+
!/**/.gitkeep
Links to this note (1)