git不会忽略符号链接 [英] git is NOT ignoring a symlink

查看:214
本文介绍了git不会忽略符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git项目,它在/ application / assets上有一个子目录,在/ assets处指向它的符号链接

assets位于.gitignore中文件在根目录中,但大约三分之一,当我生产git pull时,符号链接会被我的开发环境的路径覆盖。



我能确保git始终忽略该符号链接吗?还是有办法让它始终指向相对路径(应用程序/资产)而不是我的开发机器上的完整路径? > .gitignore 不会在拉或 merge .gitignore 只会影响未跟踪的文件。如果文件处于提交状态,则不再未跟踪。



在其中一个提交中,有人提交了您想留下未跟踪的文件,因此,那么当你提交该提交时,你将收到该文件。



从存储库中删除文件,它将再次未被跟踪。


I have a git project which has a subdirectory at /application/assets, and a symlink pointing to it at /assets

"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.

这篇关于git不会忽略符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆