Is there any way to ignore a directory when you push remotely? The catch is I don’t want to ignore it. I still want to track the directory, and have local commits and branches for it. Say, I’m working on a project that relies on a database. This project does not have transitional schema or anything. It is populated with data for testing. I have a symbolic link for MySQL’s folder/files (MyISAM MYD/MYI) to my local repository. I want the database and the commits in sync, but cannot push the database (or assets, etc). I tried a submodule, with no avail – the parent repo ignores the child submodule changes. How would I go about this? Example structure:
/repo/my-project <– git repo
/repo/my-project/src <– push commits related to this section to a remote repo that uses this as the root directory
/repo/my-project/mysql <– track these but don’t push them
/repo/my-project/mysql/db_1/table_1.frm
/repo/my-project/mysql/db_1/table_1.MYD
/repo/my-project/mysql/db_1/table_1.MYI
Thanks!
When you push a given branch, you push the commits on that branch. If those commits include the contents of a given directory, you will be pushing that content.
Your two options are:
Keep that directory on a branch (or branches) which are never merged into the branches you push. You can still merge other changes into that branch freely, of course.
Keep that directory in a separate repository. The easiest approach would then be to symlink that directory to the real location of the repository, and ignore the path. (You can ignore it in
.git/info/excludesto avoid even publishing that gitignore entry.) More detailed instructions: