I have a git project which has a subdirectory at /application/assets, and a symlink pointing to it at /assets
开发者_Go百科"assets" is in the .gitignore file in the root directory, but about one in three times, when I "git pull" on production, the symlink is overwritten with the path of my development environment.
What can I do to make sure git always ignores that symlink? Or is there a way to make it always point to a relative path (application/assets) instead of the full path on my dev machine?
.gitignore
doesn't come into play in a pull
or merge
. .gitignore
only affects untracked files. If the file is in a commit, it's no longer untracked.
In one of the commits you are pulling it, someone committed the file you wanted to leave untracked, and thus, you will receive that file when you pull that commit.
Delete the file from the repository, and it will become untracked again.
Are you sure that the symlink hasn't been committed in production? That behaviour sounds like it is.
.gitignore will ignore files/dirs in your working directory, I don't think it will exclude them from being overwritten.
精彩评论